3v4l.org

run code in 300+ PHP versions simultaneously
<?php define(TRACES_MODE, 'TEXTAREA');//'TEXTAREA' or 'FIREPHP' $GLOBALS['traces.pre']=array(); function my_array_diff($arr1, $arr2) {foreach ($arr1 as $k=>$v) {if (in_array($v, $arr2, true)) {unset($arr1[$k]); } } return $arr1; } function my_var_export($var, $is_str=false) {$rtn=preg_replace(array('/Array\s+\(/', '/\[(\d+)\] => (.*)\n/', '/\[([^\d].*)\] => (.*)\n/'), array('array (', '\1 => \'\2\''."\n", '\'\1\' => \'\2\''."\n"), substr(print_r($var, true), 0, -1)); $rtn=strtr($rtn, array("=> 'array ('"=>'=> array (')); $rtn=strtr($rtn, array(")\n\n"=>")\n")); $rtn=strtr($rtn, array("'\n"=>"',\n", ")\n"=>"),\n")); $rtn=preg_replace(array('/\n +/e'), array('strtr(\'\0\', array(\' \'=>\' \'))'), $rtn); $rtn=strtr($rtn, array(" Object',"=>" Object'<-")); if ($is_str) {return $rtn; } else {echo $rtn; } } function tick_handler() {$tmp=debug_backtrace(); $trace=my_array_diff($tmp, $GLOBALS['traces.pre']); //echo '<pre>';var_export($trace);echo '</pre>';echo '<br/>'; //for debug diyism_trace.php $trace=array_values($trace); $GLOBALS['traces.pre']=$tmp; if (count($trace)>0 && $trace[0]['file'].'/'.@$tmp[1]['function']!==@$GLOBALS['traces'][count($GLOBALS['traces'])-1]['key']) //filter empty array and rearrange array_values(), because some lines will trigger two tick events per line, for example: 1.last line is "some code;questmark>" 2.error_reporting(... {for ($i=count($trace)-1; $i>=0; --$i) {$GLOBALS['traces'][]=$tmp_fb=array_merge(array('key'=>$trace[$i]['file'].'/'.@$tmp[$i+1]['function']), $trace[$i], array('function'=>strtr($trace[$i]['function'], array('tick_handler'=>'CONTINUE')), 'in_function'=>@$tmp[$i+1]['function'])); TRACES_MODE==='FIREPHP'?fb(trace_output($tmp_fb), 'diyism_trace:'.++$GLOBALS['diyism_trace_no']):''; } } } function trace_output($trace) {$trace['in_function']=strtr(@$trace['in_function'], array('require'=>'', 'require_once'=>'', 'include'=>'', 'include_once'=>'')); $trace['args']=$trace['args']?strtr(preg_replace(array('/\n +/'), array(''), preg_replace(array('/\n \d+ => /'), array(''), substr(my_var_export($trace['args'], true), 7, -3))), array("\r"=>'\r', "\n"=>'\n')):''; return $trace['file'].($trace['in_function']?'/'.$trace['in_function'].'()':'').'/'.$trace['line'].': '.$trace['function'].'('.$trace['args'].')'; } function traces_output() {echo '<textarea style="width:100%;height:300px;">'; $GLOBALS['traces']=array_slice($GLOBALS['traces'], 2);//remove registering tick line and requiring 'diyism_trace.php' line foreach ($GLOBALS['traces'] as $k=>$trace) {echo htmlentities($k.':'.trace_output($trace)."\n"); } echo '</textarea>'; } register_tick_function('tick_handler'); TRACES_MODE==='TEXTAREA'?register_shutdown_function('traces_output'):''; ?> <?php declare(ticks=1); require 'diyism_trace.php'; a('a', array('hello')); 1+2; b(); function a() {$d=1; b(); $d=2; } function b() {1+1; } ?>

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.0120.00316.88
8.3.50.0090.00821.94
8.3.40.0140.00418.84
8.3.30.0070.00719.17
8.3.20.0040.00420.20
8.3.10.0080.00023.71
8.3.00.0030.00519.25
8.2.180.0100.00617.00
8.2.170.0130.00922.96
8.2.160.0070.00720.52
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0000.00822.21
8.2.110.0030.00619.31
8.2.100.0040.00817.87
8.2.90.0040.00419.05
8.2.80.0060.00317.97
8.2.70.0000.00817.75
8.2.60.0030.00617.80
8.2.50.0000.01018.10
8.2.40.0000.00818.02
8.2.30.0040.00418.02
8.2.20.0040.00417.89
8.2.10.0000.00819.91
8.2.00.0000.00817.82
8.1.280.0120.00625.92
8.1.270.0000.00922.23
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0050.00522.81
8.1.230.0090.00317.82
8.1.220.0030.00517.79
8.1.210.0000.00918.77
8.1.200.0060.00317.37
8.1.190.0040.00417.36
8.1.180.0040.00418.10
8.1.170.0000.00818.82
8.1.160.0040.00422.00
8.1.150.0000.00718.67
8.1.140.0000.00717.47
8.1.130.0070.00017.89
8.1.120.0040.00417.48
8.1.110.0040.00417.49
8.1.100.0040.00417.40
8.1.90.0040.00417.46
8.1.80.0000.00717.37
8.1.70.0000.00717.43
8.1.60.0030.00617.59
8.1.50.0000.00817.52
8.1.40.0000.00817.49
8.1.30.0060.00317.58
8.1.20.0080.00017.73
8.1.10.0050.00317.54
8.1.00.0000.00817.50
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0070.00018.58
8.0.270.0040.00417.31
8.0.260.0000.00716.96
8.0.250.0050.00217.09
8.0.240.0040.00417.10
8.0.230.0000.00716.99
8.0.220.0000.00717.05
8.0.210.0030.00316.98
8.0.200.0000.00717.11
8.0.190.0090.00017.08
8.0.180.0040.00417.07
8.0.170.0000.00817.13
8.0.160.0040.00417.14
8.0.150.0000.00717.02
8.0.140.0040.00416.97
8.0.130.0060.00313.45
8.0.120.0000.00716.84
8.0.110.0040.00416.92
8.0.100.0040.00416.86
8.0.90.0050.00316.82
8.0.80.0080.00717.02
8.0.70.0000.00717.05
8.0.60.0050.00216.89
8.0.50.0000.00817.07
8.0.30.0100.01017.14
8.0.20.0140.00917.40
8.0.10.0050.00317.11
8.0.00.0120.01216.98
7.4.330.0000.00515.00
7.4.320.0000.00616.75
7.4.300.0030.00316.52
7.4.290.0030.00316.65
7.4.280.0070.00016.59
7.4.270.0040.00416.51
7.4.260.0060.00316.45
7.4.250.0040.00416.59
7.4.240.0020.00516.70
7.4.230.0000.00716.71
7.4.220.0120.01516.73
7.4.210.0070.00816.73
7.4.200.0080.00016.50
7.4.190.0000.00716.52
7.4.160.0030.01316.55
7.4.150.0110.00717.40
7.4.140.0110.01217.86
7.4.130.0080.00916.63
7.4.120.0130.00316.62
7.4.110.0100.00716.74
7.4.100.0080.01216.66
7.4.90.0000.01716.50
7.4.80.0060.01619.39
7.4.70.0060.01116.59
7.4.60.0070.01316.67
7.4.50.0000.00816.59
7.4.40.0070.00722.77
7.4.30.0000.01616.68
7.4.00.0100.00615.34
7.3.330.0000.00713.40
7.3.320.0000.00613.55
7.3.310.0040.00416.61
7.3.300.0000.00716.61
7.3.290.0040.01216.59
7.3.280.0070.01016.57
7.3.270.0100.00717.40
7.3.260.0160.00816.53
7.3.250.0080.01116.44
7.3.240.0100.01416.57
7.3.230.0030.01616.67
7.3.210.0040.01416.60
7.3.200.0100.01319.39
7.3.190.0060.01016.66
7.3.180.0000.01516.55
7.3.170.0080.00816.44
7.3.160.0090.01216.73
7.3.120.0040.01415.15
7.2.330.0060.01216.88
7.2.320.0120.01216.79
7.2.310.0100.00716.70
7.2.300.0150.00916.90
7.2.290.0030.01516.83
7.2.60.0060.00616.80
7.2.00.0030.00919.54
7.1.200.0060.00615.95
7.1.100.0200.00918.23
7.1.70.0030.00717.26
7.1.60.0150.01119.33
7.1.50.0070.01417.11
7.1.00.0030.09322.31
7.0.200.0080.00516.61
7.0.140.0030.07721.95
7.0.60.0130.03319.90
7.0.50.0030.08018.06
7.0.40.0030.08720.06
7.0.30.0300.04320.20
7.0.20.0300.07720.27
7.0.10.0030.06720.34
7.0.00.0070.05020.24
5.6.280.0030.07721.16
5.6.210.0200.05320.76
5.6.200.0100.07018.21
5.6.190.0000.09020.35
5.6.180.0370.04320.43
5.6.170.0300.05020.48
5.6.160.0030.08020.49
5.6.150.0070.04318.28
5.6.140.0170.05318.39
5.6.130.0100.06018.18
5.6.120.0200.03021.09
5.6.110.0170.03321.17
5.6.100.0200.06021.03
5.6.90.0030.08021.14
5.6.80.0100.04320.43
5.5.350.0270.07320.36
5.5.340.0130.07718.14
5.5.330.0100.07020.35
5.5.320.0170.08020.36
5.5.310.0400.06020.29
5.5.300.0130.07018.04
5.5.290.0100.06318.09
5.5.280.0070.04020.80
5.5.270.0070.06020.80
5.5.260.0030.05321.02
5.5.250.0030.09020.70
5.5.240.0000.08320.31
5.4.450.0370.07319.40
5.4.440.0330.05319.53
5.4.430.0300.08019.42
5.4.420.0300.07019.34
5.4.410.0270.06019.49
5.4.400.0200.05719.16
5.4.390.0370.06719.14
5.4.380.0270.07719.23
5.4.370.0270.06718.88
5.4.360.0330.05719.25
5.4.350.0400.06019.23
5.4.340.0330.06319.10
5.4.320.0270.04019.23
5.4.310.0300.05719.00
5.4.300.0300.06019.06
5.4.290.0430.05318.86
5.4.280.0270.04018.98
5.4.270.0300.05018.98
5.4.260.0370.06319.17
5.4.250.0400.05019.23
5.4.240.0270.05719.31
5.4.230.0300.07019.23
5.4.220.0300.05718.99
5.4.210.0270.06719.24
5.4.200.0370.05318.99
5.4.190.0330.06319.31
5.4.180.0300.06018.84
5.4.170.0230.07718.87
5.4.160.0300.04019.18
5.4.150.0300.05318.94
5.4.140.0300.06716.36
5.4.130.0270.06316.34
5.4.120.0300.06016.47
5.4.110.0400.04016.60
5.4.100.0400.06016.60
5.4.90.0330.04316.64
5.4.80.0270.06716.63
5.4.70.0300.05716.51
5.4.60.0330.05316.45
5.4.50.0270.07016.28
5.4.40.0400.04716.40
5.4.30.0270.07016.27
5.4.20.0270.06716.29
5.4.10.0270.05716.45
5.4.00.0230.06315.96
5.3.290.0270.07314.72
5.3.280.0400.05714.65
5.3.270.0200.05014.74
5.3.260.0330.05714.64
5.3.250.0330.06314.73
5.3.240.0270.07314.64
5.3.230.0300.05014.57
5.3.220.0370.05314.64
5.3.210.0330.06714.62
5.3.200.0230.07714.64
5.3.190.0270.04314.54
5.3.180.0200.07314.68
5.3.170.0300.07314.54
5.3.160.0330.04314.73
5.3.150.0170.04714.70
5.3.140.0270.03714.73
5.3.130.0270.04714.54
5.3.120.0300.07014.73
5.3.110.0300.06314.52
5.3.100.0200.04314.13
5.3.90.0400.05714.16
5.3.80.0370.06013.99
5.3.70.0300.06714.29
5.3.60.0230.05014.05
5.3.50.0300.05713.91
5.3.40.0300.06314.02
5.3.30.0270.07013.97
5.3.20.0370.06013.68
5.3.10.0370.06013.73
5.3.00.0270.05713.60
5.2.170.0270.05312.08
5.2.160.0300.05312.08
5.2.150.0170.05312.08
5.2.140.0270.05712.08
5.2.130.0230.05012.08
5.2.120.0270.03712.08
5.2.110.0200.03712.08
5.2.100.0230.04012.08
5.2.90.0200.04712.08
5.2.80.0170.06012.08
5.2.70.0200.06012.08
5.2.60.0270.05312.08
5.2.50.0300.05712.08
5.2.40.0270.04712.08
5.2.30.0200.05712.08
5.2.20.0200.04012.08
5.2.10.0230.05312.08
5.2.00.0230.04012.08
5.1.60.0130.03312.08
5.1.50.0230.03312.08
5.1.40.0230.04312.08
5.1.30.0170.02712.08
5.1.20.0170.04012.08
5.1.10.0170.03312.08
5.1.00.0200.03012.08
5.0.50.0100.03312.08
5.0.40.0130.02712.08
5.0.30.0100.06012.08
5.0.20.0130.03712.08
5.0.10.0100.04312.08
5.0.00.0170.04012.08
4.4.90.0170.02012.08
4.4.80.0230.01312.08
4.4.70.0100.02012.08
4.4.60.0100.02312.08
4.4.50.0100.02312.08
4.4.40.0100.05312.08
4.4.30.0130.02712.08
4.4.20.0100.01312.08
4.4.10.0130.03012.08
4.4.00.0100.04012.08
4.3.110.0100.03312.08
4.3.100.0130.02712.08
4.3.90.0130.03312.08
4.3.80.0130.02012.08
4.3.70.0100.01712.08
4.3.60.0030.02712.08
4.3.50.0170.02712.08
4.3.40.0070.04012.08
4.3.30.0030.02312.08
4.3.20.0070.02312.08
4.3.10.0100.03312.08
4.3.00.0070.02712.08

preferences:
37.95 ms | 401 KiB | 5 Q