3v4l.org

run code in 300+ PHP versions simultaneously
<pre><?php print "\n"; $web=true; //output for HTML (true) or Console (false) class simobject{} $res1=curl_init(); $res2=imagecreate(1,1); $q=array($res2,$res1,NAN,INF,-INF,NULL,'',array(),'true','text',TRUE,1,1e0,'1',FALSE,'false','-','+',chr(0),0,'0',0e0,-1,-1e0,'-01','-001','01','001'); if ($web) $lt='&lt';else $lt='<'; if ($web) $gt='&gt';else $gt='>'; function prhead($spc){ global $lt,$gt; print "\n".str_pad('$a',$spc-1,' ',STR_PAD_BOTH).'VS.'.str_pad('$b',$spc-1,' ',STR_PAD_BOTH).' '; print '$a'.$gt.'$b'." ".'$a'.$lt.'$b'." ".'$a'.$lt.'=$b'." ".'$a'.$gt.'=$b'; print " ".'$a==$b'." ".'$a===$b'." \n"; } function prline($item,$spc){ print str_pad($item['typea'].'('.$item['vala'].')',$spc,' ',STR_PAD_BOTH).' '; print str_pad($item['typeb'].'('.$item['valb'].')',$spc,' ',STR_PAD_BOTH); unset($item['typea']);unset($item['typeb']); unset($item['vala']);unset($item['valb']);unset($item['a']);unset($item['b']); foreach ($item as $i) print ' '.str_pad($i,5,' ',STR_PAD_LEFT); print " \n"; } function prabc($item,$spc){ global $lt,$gt; print str_pad($item['typea'].'('.$item['vala'].') ',$spc,' ',STR_PAD_BOTH).$gt.' '; print str_pad($item['typeb'].'('.$item['valb'].') ',$spc,' ',STR_PAD_BOTH).$gt.' '; print str_pad($item['typec'].'('.$item['valc'].')',$spc,' ',STR_PAD_BOTH); print "\n"; } $wh=array('boolean','string','double','integer'); $to=array('bool','str','float','int'); $cleanup=array("'' . "," . ''","\n",'array ()'); $res=array();$crazy=array();$equality=array();$ltgt=array();$compatible=array();$greater=array(); $types=array();$vals=array(); foreach ($q as $a) { foreach ($q as $b) { $item=array(); $typea=str_replace($wh,$to,gettype($a));$types[$typea]=strlen($typea); $vala=str_replace($cleanup,'',var_export($a,true)); $vals[$vala]=strlen($vala); $typeb=str_replace($wh,$to,gettype($b));$types[$typeb]=strlen($typeb); $valb=str_replace($cleanup,'',var_export($b,true)); $vals[$valb]=strlen($valb); //if (($typea!=$typeb)||($vala!=$valb)){ $item['gt']=var_export($a>$b,true); $item['lt']=var_export($a<$b,true); $item['lte']=var_export($a<=$b,true); $item['gte']=var_export($a>=$b,true); $item['eq']=var_export($a==$b,true); $item['eqs']=var_export($a===$b,true); $same=$item; $item['a']=$a; $item['b']=$b; $item['typea']=$typea; $item['typeb']=$typeb; $item['vala']=$vala; $item['valb']=$valb; $head=array($typea.'('.$vala.')',$typeb.'('.$valb.')'); sort($head); $head=implode('',$head); //funny huh? if ($item['gt']=='true') $greater[]=$item; if (count(array_unique($same))==1) { if (!isset($crazy[$head])) $crazy[$head]=$item; } elseif ($item['eq']!=$item['eqs']) { if (!isset($equality[$head])) $equality[$head]=$item; } elseif (($item['eq']==$item['eqs'])&&($item['eq']=='true')) { if (!isset($compatible[$head])) $compatible[$head]=$item; } elseif (($item['lt']==$item['gt'])&&($item['gt']=='true')) { if (!isset($ltgt[$head])) $ltgt[$head]=$item; } else { if (!isset($res[$head])) $res[$head]=$item; } //} } } ksort($crazy); ksort($res); ksort($ltgt); ksort($equality); ksort($compatible); $spc=max($vals)+max($types)+2; /* print "Very strange: "; prhead($spc); foreach ($crazy as $item) prline($item,$spc); print "</pre>\n"; print "Equal but not identical: \n<pre>"; prhead($spc); foreach ($equality as $item) prline($item,$spc); print "</pre>\n"; print "Lower and Greater at the same time? \n<pre>"; prhead($spc); foreach ($ltgt as $item) prline($item,$spc); print "</pre>\n"; print "Lower or Greater: \n<pre>"; prhead($spc); foreach ($res as $item) prline($item,$spc); */ /* // Mostly A to A comparisons, strange for INF and -INF only print "Compatible (equal and identical): \n<pre>"; prhead($spc); foreach ($compatible as $item) prline($item,$spc); print "</pre>\n"; */ print "\n".'The "$a '.$gt.' $b '.$gt.' $c" --'.$gt.' "$a not '.$gt.' than $c" Conundrum'."\n"; $total=count($greater); print 'Total greater: '.$total."\n"; ?></pre>

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.0140.00716.63
8.3.50.0110.00518.10
8.3.40.0070.00718.88
8.3.30.0110.00718.70
8.3.20.0050.00318.99
8.3.10.0080.00820.61
8.3.00.0050.00319.50
8.2.180.0150.00616.75
8.2.170.0130.00722.96
8.2.160.0080.00819.14
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0160.00326.16
8.2.120.0070.00420.49
8.2.110.0090.00022.14
8.2.100.0050.00917.78
8.2.90.0070.00319.43
8.2.80.0080.00019.34
8.2.70.0000.00917.75
8.2.60.0000.00818.16
8.2.50.0030.00918.07
8.2.40.0080.00018.22
8.2.30.0040.00418.00
8.2.20.0060.00317.66
8.2.10.0030.00617.85
8.2.00.0030.00517.76
8.1.280.0070.01125.92
8.1.270.0060.00323.99
8.1.260.0060.01226.35
8.1.250.0080.00828.09
8.1.240.0070.00423.61
8.1.230.0080.00321.03
8.1.220.0040.00417.74
8.1.210.0000.00818.91
8.1.200.0070.00317.50
8.1.190.0030.00617.66
8.1.180.0000.00818.10
8.1.170.0040.00418.78
8.1.160.0040.00418.89
8.1.150.0050.00318.66
8.1.140.0080.00017.41
8.1.130.0070.00017.98
8.1.120.0100.00017.40
8.1.110.0000.00717.38
8.1.100.0000.00817.36
8.1.90.0000.00817.50
8.1.80.0000.00917.47
8.1.70.0000.00717.37
8.1.60.0040.01117.54
8.1.50.0040.00417.44
8.1.40.0060.00317.52
8.1.30.0050.00317.64
8.1.20.0040.00417.75
8.1.10.0000.00817.72
8.1.00.0040.00417.66
8.0.300.0070.00320.16
8.0.290.0030.00616.88
8.0.280.0030.00318.53
8.0.270.0000.00717.37
8.0.260.0070.00017.03
8.0.250.0000.00717.02
8.0.240.0000.00717.01
8.0.230.0000.00817.07
8.0.220.0030.00317.04
8.0.210.0000.00717.02
8.0.200.0030.00317.09
8.0.190.0050.00216.95
8.0.180.0040.00416.99
8.0.170.0030.00616.98
8.0.160.0080.00017.06
8.0.150.0030.00616.87
8.0.140.0040.00416.87
8.0.130.0030.00313.43
8.0.120.0050.00316.96
8.0.110.0040.00416.90
8.0.100.0080.00016.90
8.0.90.0040.00416.86
8.0.80.0070.00816.97
8.0.70.0040.00417.11
8.0.60.0000.00817.05
8.0.50.0030.00516.99
8.0.30.0120.00817.32
8.0.20.0120.00917.09
8.0.10.0040.00417.18
8.0.00.0140.01017.00
7.4.330.0000.00613.01
7.4.320.0030.00316.54
7.4.300.0030.00616.71
7.4.290.0030.00316.60
7.4.280.0060.00316.71
7.4.270.0000.00716.71
7.4.260.0050.00013.49
7.4.250.0030.00616.62
7.4.240.0040.00416.69
7.4.230.0050.00316.57
7.4.220.0030.01416.64
7.4.210.0060.01116.77
7.4.200.0040.00416.44
7.4.190.0000.00716.81
7.4.160.0110.00516.68
7.4.150.0180.00716.61
7.4.140.0140.00416.46
7.4.130.0090.00916.55
7.4.120.0090.01416.43
7.4.110.0110.00716.49
7.4.100.0090.00916.65
7.4.90.0100.01016.79
7.4.80.0090.00916.66
7.4.70.0070.01016.82
7.4.60.0040.01216.50
7.4.50.0030.00516.64
7.4.40.0060.00916.53
7.4.30.0030.01316.66
7.4.00.0070.01015.11
7.3.330.0030.00313.32
7.3.320.0000.00513.24
7.3.310.0040.00416.36
7.3.300.0000.00716.36
7.3.290.0050.00916.45
7.3.280.0090.01216.41
7.3.270.0230.00316.66
7.3.260.0120.00616.47
7.3.250.0110.00716.44
7.3.240.0100.00716.66
7.3.230.0130.00816.60
7.3.210.0150.00416.55
7.3.200.0090.00919.39
7.3.190.0120.00916.68
7.3.180.0130.00316.59
7.3.170.0060.00916.71
7.3.160.0130.00316.57
7.3.120.0060.01114.86
7.3.110.0040.01515.11
7.3.100.0120.00014.84
7.3.90.0030.00614.95
7.3.80.0070.01014.91
7.3.70.0030.01014.64
7.3.60.0030.00614.90
7.3.50.0030.01214.68
7.3.40.0030.00914.93
7.3.30.0080.00814.72
7.3.20.0060.00816.56
7.3.10.0030.01016.75
7.3.00.0040.01116.67
7.2.330.0090.00816.45
7.2.320.0070.01016.79
7.2.310.0060.01616.82
7.2.300.0060.01216.77
7.2.290.0090.01216.76
7.2.250.0140.00315.23
7.2.240.0070.01414.61
7.2.230.0070.01015.14
7.2.220.0090.00614.94
7.2.210.0090.00615.24
7.2.200.0030.01215.05
7.2.190.0060.00315.02
7.2.180.0120.00615.14
7.2.170.0060.00615.17
7.2.60.0070.00716.59
7.2.00.0030.01019.23
7.1.330.0000.01315.67
7.1.320.0030.01015.82
7.1.310.0040.00715.61
7.1.300.0040.00815.67
7.1.290.0060.00915.73
7.1.280.0030.00715.63
7.1.270.0030.00915.63
7.1.260.0100.00315.74
7.1.200.0040.00815.40
7.1.100.0060.00617.86
7.1.70.0000.00716.74
7.1.60.0070.01719.17
7.1.50.0100.01416.78
7.1.00.0030.04722.28
7.0.200.0060.00316.39
7.0.140.0000.07322.18
7.0.120.0030.07022.16
7.0.100.0130.07320.14
7.0.90.0070.08320.07
7.0.80.0070.08320.02
7.0.70.0070.07320.01
7.0.60.0430.07020.04
7.0.50.0170.09020.46
7.0.40.0030.09020.00
7.0.30.0070.08320.05
7.0.20.0070.08720.13
7.0.10.0100.07720.03
7.0.00.0100.08320.07
5.6.280.0070.06721.21
5.6.250.0070.04720.73
5.6.240.0000.06020.59
5.6.230.0070.05020.60
5.6.220.0200.07020.74
5.6.210.0100.08020.53
5.6.200.0170.07321.15
5.6.190.0070.08321.01
5.6.180.0100.08021.01
5.6.170.0200.04021.05
5.6.160.0130.07721.17
5.6.150.0130.07321.14
5.6.140.0100.08021.08
5.6.130.0100.05021.03
5.6.120.0070.08321.16
5.6.110.0100.08321.01
5.6.100.0070.04721.10
5.6.90.0070.07321.16
5.6.80.0070.07720.46
5.6.70.0130.07020.39
5.6.60.0030.09320.39
5.6.50.0130.07320.59
5.6.40.0070.08020.50
5.6.30.0100.07720.50
5.6.20.0100.04320.55
5.6.10.0200.06020.37
5.6.00.0070.07720.43
5.5.380.0070.06020.49
5.5.370.0130.07320.48
5.5.360.0030.06320.59
5.5.350.0130.08720.45
5.5.340.0130.07720.84
5.5.330.0070.08320.86
5.5.320.0200.07320.96
5.5.310.0170.07720.86
5.5.300.0070.07720.87
5.5.290.0200.07320.89
5.5.280.0100.08020.97
5.5.270.0100.08020.98
5.5.260.0100.07020.89
5.5.250.0130.07720.76
5.5.240.0100.04320.35
5.5.230.0070.08020.33
5.5.220.0130.04720.17
5.5.210.0000.08320.24
5.5.200.0170.07020.15
5.5.190.0130.07720.19
5.5.180.0100.05020.20
5.5.160.0130.08020.29
5.5.150.0030.08020.21
5.5.140.0100.07320.20
5.5.130.0130.07020.20
5.5.120.0070.05020.23
5.5.110.0070.08020.33
5.5.100.0030.08720.16
5.5.90.0100.06720.07
5.5.80.0100.07320.19
5.5.70.0130.04720.23
5.5.60.0100.04020.12
5.5.50.0100.07020.20
5.5.40.0100.07720.18
5.5.30.0070.08720.21
5.5.20.0030.08320.21
5.5.10.0100.08020.03
5.5.00.0030.09020.10
5.4.450.0000.08319.51
5.4.440.0070.05319.21
5.4.430.0130.07319.44
5.4.420.0130.07019.44
5.4.410.0030.08019.40
5.4.400.0100.07318.91
5.4.390.0030.08319.16
5.4.380.0100.07318.91
5.4.370.0100.07018.95
5.4.360.0070.07719.13
5.4.350.0100.08019.09
5.4.340.0030.06018.85
5.4.320.0130.06719.23
5.4.310.0070.05719.20
5.4.300.0100.07319.18
5.4.290.0070.07719.14
5.4.280.0070.07319.23
5.4.270.0070.06718.84
5.4.260.0030.08319.03
5.4.250.0030.05719.04
5.4.240.0070.07719.04
5.4.230.0200.06319.22
5.4.220.0070.07718.94
5.4.210.0070.08019.05
5.4.200.0030.05719.13
5.4.190.0100.07319.17
5.4.180.0170.04719.06
5.4.170.0130.07319.17
5.4.160.0170.06719.10
5.4.150.0070.06718.83
5.4.140.0130.07016.35
5.4.130.0070.07016.41
5.4.120.0070.07016.50
5.4.110.0070.07316.32
5.4.100.0070.07016.52
5.4.90.0030.06016.50
5.4.80.0070.07016.47
5.4.70.0070.07316.38
5.4.60.0030.07316.44
5.4.50.0070.04716.54
5.4.40.0030.04716.46
5.4.30.0100.06316.52
5.4.20.0070.05316.35
5.4.10.0100.03716.48
5.4.00.0000.07315.90
5.3.290.0100.07314.70
5.3.280.0070.05314.72
5.3.270.0070.07714.68
5.3.260.0070.07314.61
5.3.250.0070.07014.68
5.3.240.0030.08014.78
5.3.230.0100.07714.71
5.3.220.0000.07714.63
5.3.210.0070.06714.59
5.3.200.0070.05314.76
5.3.190.0100.08014.60
5.3.180.0100.07014.61
5.3.170.0070.06714.58
5.3.160.0070.07714.75
5.3.150.0000.08014.64
5.3.140.0070.06314.64
5.3.130.0000.08714.71
5.3.120.0070.07314.73
5.3.110.0070.04714.71
5.3.100.0030.08014.21
5.3.90.0070.06014.05
5.3.80.0130.06714.21
5.3.70.0070.06014.05
5.3.60.0030.06713.97
5.3.50.0070.07013.93
5.3.40.0070.07714.07
5.3.30.0030.04314.07
5.3.20.0130.04013.65
5.3.10.0100.06713.74
5.3.00.0100.07013.83

preferences:
43.55 ms | 401 KiB | 5 Q