3v4l.org

run code in 300+ PHP versions simultaneously
<pre><?php print "\n"; $web=true; //output for HTML (true) or Console (false) class simobject{} $res2=imagecreate(1,1); $q=array($res2,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.0110.00418.55
8.3.50.0120.00717.57
8.3.40.0080.00818.84
8.3.30.0120.00318.79
8.3.20.0050.00318.90
8.3.10.0090.00020.53
8.3.00.0040.00419.25
8.2.180.0100.01025.92
8.2.170.0090.00618.97
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00018.97
8.2.110.0030.00622.09
8.2.100.0000.01117.97
8.2.90.0050.00519.61
8.2.80.0030.00619.59
8.2.70.0050.00317.63
8.2.60.0040.00418.16
8.2.50.0090.00018.07
8.2.40.0040.00418.21
8.2.30.0040.00418.17
8.2.20.0000.01017.64
8.2.10.0030.00517.91
8.2.00.0000.00817.85
8.1.280.0070.00725.92
8.1.270.0030.00523.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0070.00322.54
8.1.230.0140.00021.03
8.1.220.0040.00417.74
8.1.210.0030.00618.93
8.1.200.0030.00717.35
8.1.190.0050.00317.66
8.1.180.0040.00418.10
8.1.170.0070.00320.73
8.1.160.0040.00418.90
8.1.150.0060.00318.68
8.1.140.0040.00417.49
8.1.130.0030.00317.93
8.1.120.0040.00417.41
8.1.110.0040.00417.47
8.1.100.0000.00817.50
8.1.90.0040.00417.53
8.1.80.0000.00717.48
8.1.70.0040.00417.48
8.1.60.0040.00417.61
8.1.50.0080.00017.57
8.1.40.0040.00417.66
8.1.30.0090.00017.76
8.1.20.0000.00817.82
8.1.10.0040.00417.55
8.1.00.0030.00617.47
8.0.300.0000.00820.07
8.0.290.0000.00716.88
8.0.280.0070.00018.49
8.0.270.0050.00217.41
8.0.260.0030.00316.90
8.0.250.0050.00316.96
8.0.240.0040.00416.99
8.0.230.0040.00416.96
8.0.220.0030.00317.03
8.0.210.0000.00716.90
8.0.200.0070.00016.94
8.0.190.0050.00217.08
8.0.180.0000.00817.00
8.0.170.0030.00616.83
8.0.160.0040.00416.96
8.0.150.0030.00517.00
8.0.140.0000.00816.93
8.0.130.0040.00413.39
8.0.120.0050.00316.99
8.0.110.0000.00716.95
8.0.100.0030.00516.89
8.0.90.0000.00817.06
8.0.80.0060.00916.99
8.0.70.0040.00416.83
8.0.60.0000.00816.85
8.0.50.0040.00416.96
8.0.30.0030.01417.24
8.0.20.0080.01017.09
8.0.10.0000.00717.05
8.0.00.0050.01416.73
7.4.330.0000.00613.14
7.4.320.0030.00316.63
7.4.300.0000.00716.62
7.4.290.0040.00416.63
7.4.280.0100.00016.54
7.4.270.0030.00316.59
7.4.260.0000.00613.36
7.4.250.0040.00416.49
7.4.240.0050.00216.68
7.4.230.0000.00816.49
7.4.220.0100.01116.66
7.4.210.0120.00416.71
7.4.200.0000.00816.45
7.4.190.0050.00216.48
7.4.160.0140.00916.38
7.4.150.0150.00316.66
7.4.140.0060.01216.65
7.4.130.0150.00416.86
7.4.120.0140.00316.51
7.4.110.0110.00716.57
7.4.100.0160.00316.63
7.4.90.0030.01416.56
7.4.80.0090.01416.69
7.4.70.0010.00516.43
7.4.60.0070.01016.83
7.4.50.0000.00716.62
7.4.40.0060.01016.50
7.4.30.0090.01216.68
7.4.10.0070.01115.31
7.4.00.0100.00514.95
7.3.330.0000.00613.36
7.3.320.0000.00513.25
7.3.310.0000.00716.45
7.3.300.0030.00316.37
7.3.290.0060.00816.39
7.3.280.0110.00816.37
7.3.270.0270.02016.64
7.3.260.0130.00416.51
7.3.250.0080.00916.40
7.3.240.0130.00416.72
7.3.230.0030.01316.51
7.3.210.0060.01216.35
7.3.200.0100.01119.39
7.3.190.0090.01216.71
7.3.180.0040.01216.40
7.3.170.0110.00516.53
7.3.160.0000.01616.77
7.3.130.0070.01015.17
7.3.120.0080.00914.84
7.3.110.0070.01014.91
7.3.100.0050.01214.68
7.3.90.0120.00314.93
7.3.80.0030.00814.84
7.3.70.0050.00814.78
7.3.60.0020.01314.94
7.3.50.0040.00714.87
7.3.40.0030.00614.68
7.3.30.0070.00814.91
7.3.20.0040.01116.77
7.3.10.0050.00816.55
7.3.00.0080.00616.48
7.2.330.0090.00916.66
7.2.320.0080.01816.37
7.2.310.0140.00416.71
7.2.300.0030.01416.79
7.2.290.0090.01216.34
7.2.260.0070.01415.13
7.2.250.0070.01115.19
7.2.240.0080.01014.95
7.2.230.0020.00914.96
7.2.220.0030.01015.01
7.2.210.0090.00215.10
7.2.200.0030.00915.00
7.2.190.0080.00814.89
7.2.180.0060.00715.01
7.2.170.0050.00814.97
7.2.160.0030.00914.95
7.2.150.0040.01116.72
7.2.140.0030.01016.68
7.2.130.0090.00016.69
7.2.120.0000.01616.83
7.2.110.0070.00316.82
7.2.100.0070.01116.82
7.2.90.0070.00716.92
7.2.80.0060.00616.46
7.2.70.0030.00916.72
7.2.60.0070.00716.80
7.2.50.0040.01116.64
7.2.40.0000.00916.68
7.2.30.0060.00916.97
7.2.20.0100.00317.00
7.2.10.0040.01116.94
7.2.00.0030.01117.86
7.1.330.0070.00715.76
7.1.320.0030.00815.57
7.1.310.0060.00615.58
7.1.300.0050.01115.72
7.1.290.0070.00515.68
7.1.280.0070.00615.62
7.1.270.0070.00815.40
7.1.260.0110.00315.68
7.1.250.0140.00015.64
7.1.240.0100.00715.53
7.1.230.0040.00415.48
7.1.220.0070.00715.76
7.1.210.0050.00515.72
7.1.200.0030.01115.77
7.1.190.0000.00815.68
7.1.180.0000.01315.27
7.1.170.0090.00615.31
7.1.160.0040.00815.64
7.1.150.0030.00915.71
7.1.140.0000.00915.75
7.1.130.0080.00615.68
7.1.120.0090.00615.62
7.1.110.0040.01115.79
7.1.100.0020.01116.95
7.1.90.0040.01115.71
7.1.80.0120.00315.39
7.1.70.0070.00516.31
7.1.60.0070.01017.46
7.1.50.0020.01415.96
7.1.40.0060.00315.84
7.1.30.0030.00915.70
7.1.20.0120.00615.40
7.1.10.0030.00615.40
7.1.00.0030.02019.00
7.0.330.0080.00415.24
7.0.320.0070.00715.25
7.0.310.0070.00715.42
7.0.300.0040.00415.36
7.0.290.0030.00915.27
7.0.280.0060.00615.45
7.0.270.0000.01515.30
7.0.260.0030.01015.48
7.0.250.0030.01015.07
7.0.240.0030.01015.39
7.0.230.0070.01015.39
7.0.220.0070.01015.06
7.0.210.0030.01215.36
7.0.200.0430.00514.85
7.0.190.0000.00815.47
7.0.180.0100.00315.16
7.0.170.0080.00815.41
7.0.160.0070.01115.11
7.0.150.0030.00915.44
7.0.140.0030.04218.81
7.0.130.0030.00615.41
7.0.120.0030.03918.68
7.0.110.0030.00915.08
7.0.100.0130.04217.74
7.0.90.0080.03717.62
7.0.80.0120.03117.73
7.0.70.0070.03117.75
7.0.60.0030.03817.59
7.0.50.0060.02617.95
7.0.40.0070.04516.67
7.0.30.0090.03216.72
7.0.20.0050.04716.79
7.0.10.0050.03516.68
7.0.00.0030.04516.67
5.6.400.0070.00714.39
5.6.390.0080.00414.21
5.6.380.0070.00414.36
5.6.370.0040.01214.52
5.6.360.0040.00813.99
5.6.350.0030.00614.26
5.6.340.0030.00614.40
5.6.330.0000.00914.00
5.6.320.0030.00714.70
5.6.310.0100.00314.20
5.6.300.0040.00714.28
5.6.290.0040.00814.54
5.6.280.0030.04217.81
5.6.270.0030.01414.19
5.6.260.0030.00914.09
5.6.250.0020.04317.49
5.6.240.0120.02217.63
5.6.230.0050.04117.54
5.6.220.0100.04617.44
5.6.210.0050.04217.57
5.6.200.0070.04717.54
5.6.190.0070.04917.75
5.6.180.0050.04317.70
5.6.170.0050.02117.81
5.6.160.0090.04117.70
5.6.150.0030.02517.69
5.6.140.0070.02217.72
5.6.130.0080.02317.58
5.6.120.0100.04017.59
5.6.110.0080.02317.83
5.6.100.0050.03417.72
5.6.90.0050.02917.63
5.6.80.0090.02217.49
5.6.70.0030.02317.28
5.6.60.0020.02617.37
5.6.50.0060.02217.26
5.6.40.0060.02317.46
5.6.30.0110.01917.38
5.6.20.0050.02417.53
5.6.10.0000.02517.39
5.6.00.0080.02017.41
5.5.380.0100.04017.34
5.5.370.0070.04517.18
5.5.360.0070.04317.23
5.5.350.0070.04417.33
5.5.340.0100.03717.62
5.5.330.0120.04017.52
5.5.320.0050.04717.68
5.5.310.0040.02417.71
5.5.300.0060.03517.59
5.5.290.0030.04817.54
5.5.280.0050.03317.46
5.5.270.0070.02317.52
5.5.260.0020.03817.69
5.5.250.0060.02317.38
5.5.240.0090.02017.23
5.5.230.0100.01817.22
5.5.220.0050.02217.22
5.5.210.0070.02417.19
5.5.200.0060.02417.25
5.5.190.0050.02516.99
5.5.180.0060.02517.14
5.5.170.0070.00713.95
5.5.160.0030.02317.23
5.5.150.0050.02417.29
5.5.140.0070.02317.30
5.5.130.0100.01817.18
5.5.120.0050.02217.24
5.5.110.0020.02517.23
5.5.100.0070.02517.12
5.5.90.0090.02016.97
5.5.80.0040.02617.10
5.5.70.0000.02716.98
5.5.60.0070.02317.11
5.5.50.0060.02317.14
5.5.40.0050.02517.10
5.5.30.0030.02717.20
5.5.20.0030.02317.24
5.5.10.0050.01817.14
5.5.00.0030.02217.13
5.4.450.0010.03115.84
5.4.440.0030.02615.75
5.4.430.0070.03515.85
5.4.420.0020.02415.72
5.4.410.0020.02515.79
5.4.400.0080.02015.66
5.4.390.0040.02315.68
5.4.380.0050.02115.66
5.4.370.0030.02715.69
5.4.360.0080.02415.67
5.4.350.0060.03115.68
5.4.340.0040.02315.66
5.4.330.0030.00612.22
5.4.320.0070.01715.54
5.4.310.0020.02615.72
5.4.300.0020.02215.55
5.4.290.0030.02015.53
5.4.280.0100.01715.67
5.4.270.0070.01815.64
5.4.260.0070.02015.62
5.4.250.0070.01915.58
5.4.240.0020.02815.55
5.4.230.0050.01815.69
5.4.220.0030.02015.53
5.4.210.0060.02015.73
5.4.200.0030.02215.69
5.4.190.0020.02815.64
5.4.180.0020.02215.70
5.4.170.0020.02515.58
5.4.160.0070.02215.66
5.4.150.0050.01815.65
5.4.140.0050.01614.35
5.4.130.0020.02214.30
5.4.120.0000.01814.26
5.4.110.0060.01614.30
5.4.100.0040.01914.33
5.4.90.0050.01614.37
5.4.80.0020.02014.38
5.4.70.0040.03114.35
5.4.60.0060.02714.34
5.4.50.0050.03314.37
5.4.40.0000.04514.31
5.4.30.0040.03914.27
5.4.20.0030.02314.37
5.4.10.0060.01614.38
5.4.00.0050.01714.06
5.3.290.0040.02013.52
5.3.280.0050.01913.48
5.3.270.0010.01813.51
5.3.260.0030.02213.44
5.3.250.0030.01813.47
5.3.240.0050.02013.41
5.3.230.0070.01713.47
5.3.220.0070.01413.46
5.3.210.0070.01313.47
5.3.200.0020.02013.49
5.3.190.0020.02113.47
5.3.180.0050.01513.39
5.3.170.0020.01913.38
5.3.160.0030.04413.42
5.3.150.0020.02213.49
5.3.140.0030.02313.38
5.3.130.0050.02313.44
5.3.120.0050.04413.48
5.3.110.0020.04713.38
5.3.100.0020.02113.13
5.3.90.0050.03713.14
5.3.80.0020.02813.09
5.3.70.0010.02413.16
5.3.60.0030.02313.20
5.3.50.0030.04113.12
5.3.40.0040.03813.12
5.3.30.0050.03313.12
5.3.20.0080.01312.93
5.3.10.0080.04212.97
5.3.00.0100.03312.97

preferences:
46 ms | 401 KiB | 5 Q