diff($period_end)->format('%a days, %h hours, %i minutes and %s seconds'); } elseif ( $conversion_type == 'to-hours-minutes-seconds' ) { return $period_start->diff($period_end)->format('%h hours, %i minutes and %s seconds'); } elseif ( $conversion_type == 'to-minutes-seconds' ) { return $period_start->diff($period_end)->format('%i minutes and %s seconds'); } else { return $period_start->diff($period_end)->format('%a days, %h hours, %i minutes and %s seconds'); } } /** * Remove html tags and content inside the tags from a string * * @since 3.0.3 */ public function strip_html_tags_and_content( $string ) { // Strip HTML tags and content inside them. Ref: https://stackoverflow.com/a/39320168 $string = preg_replace('@<(\w+)\b.*?>.*?@si', '', $string); // Strip any remaining HTML or PHP tags $string = strip_tags( $string ); return $string; } }