3v4l.org

run code in 300+ PHP versions simultaneously
<pre><?php print "\n"; function prhead($spc){ print "\n".str_pad('$a',$spc-1,' ',STR_PAD_BOTH).'VS.'.str_pad('$b',$spc-1,' ',STR_PAD_BOTH).' '; print '$a>$b'." ".'$a<$b'." ".'$a<=$b'." ".'$a>=$b'." ".'$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']); foreach ($item as $i) print ' '.str_pad($i,5,' ',STR_PAD_LEFT); print " \n"; } $wh=array('boolean','string','double','integer'); $to=array('bool','str','float','int'); $cleanup=array("'' . "," . ''","\n",'array ()'); class simobject{} $res1=curl_init(); $res2=imagecreate(1,1); $q=array(NAN,INF,-INF,NULL,'',array(),'true','text',TRUE,1,1e0,'1',FALSE,'false','-','+',chr(0),0,'0',0e0,-1,-1e0,'-01','-001','01','001'); //$q=array("015","0015","-015","-0015",15,"15","-15",'-',-15,'15e0','15e2',1500,15e0,15e2); //$q=array('A','a','ax','abc'); //Scientific `e` notation is of type `float`, not integer (no mater if too 'small') ! //Integers going over `PHP_INT_MAX` get automatically converted to `float` //Floats going over system's boundaries have `INF` value //Undefined variables are of type and value `NULL` //Integers preceded by `0` are converted from octal do decimal (on assignment) //Converting Strings containing an integer with a leading `0` TO integer strips the leading `0` //Fun string comparison: 'Queen' > 'King' > 'Jack' > 'Ace' $res=array();$crazy=array();$equality=array();$ltgt=array();$compatible=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['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 (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 "\nEqual but not identical: "; prhead($spc); foreach ($equality as $item) prline($item,$spc); print "\nLower and Greater at the same time? "; prhead($spc); foreach ($ltgt as $item) prline($item,$spc); print "\nCompatible (equal and identical): "; prhead($spc); foreach ($compatible as $item) prline($item,$spc); print "\nLower or Greater: "; prhead($spc); foreach ($res as $item) prline($item,$spc); ?></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.70.0040.01118.43
8.3.60.0080.00816.63
8.3.50.0090.01117.40
8.3.40.0150.00018.83
8.3.30.0000.01518.85
8.3.20.0000.00918.90
8.3.10.0030.00620.45
8.3.00.0040.00419.38
8.2.180.0210.00025.92
8.2.170.0070.00719.25
8.2.160.0100.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00318.93
8.2.110.0090.00022.30
8.2.100.0090.00317.97
8.2.90.0040.00418.28
8.2.80.0080.00019.50
8.2.70.0060.00317.71
8.2.60.0000.00818.02
8.2.50.0000.00918.07
8.2.40.0000.00818.34
8.2.30.0050.00217.99
8.2.20.0060.00317.72
8.2.10.0020.00517.72
8.2.00.0040.00417.83
8.1.280.0120.00325.92
8.1.270.0050.00223.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00322.55
8.1.230.0080.00421.08
8.1.220.0000.00817.74
8.1.210.0040.00419.03
8.1.200.0040.00417.35
8.1.190.0030.00517.66
8.1.180.0050.00318.10
8.1.170.0000.00818.90
8.1.160.0000.00719.04
8.1.150.0030.00618.68
8.1.140.0040.00417.54
8.1.130.0000.00717.95
8.1.120.0060.00317.41
8.1.110.0040.00417.50
8.1.100.0040.00417.43
8.1.90.0040.00417.32
8.1.80.0030.00417.48
8.1.70.0000.01017.46
8.1.60.0030.00517.62
8.1.50.0000.00917.59
8.1.40.0030.00517.53
8.1.30.0000.00817.66
8.1.20.0040.00417.73
8.1.10.0030.00617.57
8.1.00.0030.00517.63
8.0.300.0070.00020.20
8.0.290.0040.00417.00
8.0.280.0000.00818.46
8.0.270.0000.00717.37
8.0.260.0000.00816.99
8.0.250.0030.00516.98
8.0.240.0070.00017.03
8.0.230.0000.00717.06
8.0.220.0050.00317.06
8.0.210.0040.00416.98
8.0.200.0030.00316.95
8.0.190.0060.00317.12
8.0.180.0050.00317.03
8.0.170.0030.00616.92
8.0.160.0070.00016.87
8.0.150.0060.00316.94
8.0.140.0000.01116.93
8.0.130.0030.00313.35
8.0.120.0000.00716.97
8.0.110.0070.00017.05
8.0.100.0000.00816.82
8.0.90.0000.00717.03
8.0.80.0060.01016.93
8.0.70.0040.00416.90
8.0.60.0050.00316.82
8.0.50.0020.00516.84
8.0.30.0110.00817.23
8.0.20.0050.01417.10
8.0.10.0000.00717.02
8.0.00.0080.01416.99
7.4.330.0050.00012.93
7.4.320.0000.00716.59
7.4.300.0030.00316.51
7.4.290.0030.00316.60
7.4.280.0040.00416.55
7.4.270.0030.00316.59
7.4.260.0060.00013.29
7.4.250.0000.00816.70
7.4.240.0000.00716.63
7.4.230.0040.00416.80
7.4.220.0100.00716.55
7.4.210.0120.00916.72
7.4.200.0030.00316.41
7.4.190.0060.00316.65
7.4.160.0030.01316.43
7.4.150.0250.00016.67
7.4.140.0090.00916.70
7.4.130.0140.00616.59
7.4.120.0130.00316.61
7.4.110.0030.01716.68
7.4.100.0130.00816.64
7.4.90.0090.00916.60
7.4.80.0070.01419.39
7.4.70.0080.00816.75
7.4.60.0130.00416.65
7.4.50.0040.00416.55
7.4.40.0130.00316.53
7.4.30.0160.00016.59
7.4.00.0070.01014.77
7.3.330.0080.00013.27
7.3.320.0030.00313.38
7.3.310.0000.00816.41
7.3.300.0050.00216.42
7.3.290.0110.00716.40
7.3.280.0080.01016.40
7.3.270.0080.01116.34
7.3.260.0180.00016.52
7.3.250.0100.00716.35
7.3.240.0030.01416.38
7.3.230.0090.00916.54
7.3.210.0120.00616.55
7.3.200.0030.01716.39
7.3.190.0150.00616.43
7.3.180.0110.00416.40
7.3.170.0110.00716.46
7.3.160.0070.01516.48
7.3.120.0110.00414.96
7.2.330.0060.01216.83
7.2.320.0140.00416.64
7.2.310.0030.01516.73
7.2.300.0230.00516.41
7.2.290.0110.00816.44
7.2.60.0030.00916.84
7.2.00.0100.00319.47
7.1.200.0030.01015.65
7.1.100.0060.00618.00
7.1.70.0040.00817.16
7.1.60.0140.01019.30
7.1.50.0110.01116.79
7.1.00.0000.08022.45
7.0.200.2210.00714.62
7.0.140.0070.06322.13
7.0.120.0030.07322.19
7.0.100.0170.03720.18
7.0.90.0100.03720.13
7.0.80.0130.03320.08
7.0.70.0200.03019.99
7.0.60.0100.04020.04
7.0.50.0000.04720.35
7.0.40.0100.03320.00
7.0.30.0000.05020.00
7.0.20.0030.05020.15
7.0.10.0070.03720.08
7.0.00.0030.04720.17
5.6.280.0070.07021.18
5.6.250.0030.03720.77
5.6.240.0070.04720.69
5.6.230.0100.03720.64
5.6.220.0000.04720.71
5.6.210.0000.04320.71
5.6.200.0000.04321.06
5.6.190.0000.06321.00
5.6.180.0000.05021.16
5.6.170.0100.05321.07
5.6.160.0130.03721.17
5.6.150.0000.04321.14
5.6.140.0100.07721.07
5.6.130.0030.08721.01
5.6.120.0200.07321.06
5.6.110.0030.09321.07
5.6.100.0130.08021.01
5.6.90.0070.07321.09
5.6.80.0100.08020.45
5.6.70.0170.07320.45
5.6.60.0130.07020.38
5.6.50.0170.07020.50
5.6.40.0130.07720.57
5.6.30.0130.06720.44
5.6.20.0070.07020.46
5.6.10.0200.06720.46
5.6.00.0070.07720.47
5.5.380.0030.05320.59
5.5.370.0070.04320.57
5.5.360.0130.05020.41
5.5.350.0070.05720.48
5.5.340.0070.06020.93
5.5.330.0000.05020.83
5.5.320.0030.08320.96
5.5.310.0000.04320.79
5.5.300.0130.07720.98
5.5.290.0100.07320.79
5.5.280.0100.07720.79
5.5.270.0100.07720.89
5.5.260.0030.09020.78
5.5.250.0030.06020.59
5.5.240.0000.08720.18
5.5.230.0030.08020.23
5.5.220.0030.08320.31
5.5.210.0070.08020.32
5.5.200.0100.07720.17
5.5.190.0000.08720.27
5.5.180.0100.06720.20
5.5.160.0170.07020.32
5.5.150.0170.06020.33
5.5.140.0000.08320.32
5.5.130.0170.07320.19
5.5.120.0070.05320.23
5.5.110.0130.07320.27
5.5.100.0030.05320.13
5.5.90.0030.07720.21
5.5.80.0100.08020.13
5.5.70.0000.08320.11
5.5.60.0070.06320.20
5.5.50.0030.08020.17
5.5.40.0030.07720.02
5.5.30.0130.07320.21
5.5.20.0070.07320.11
5.5.10.0100.06320.19
5.5.00.0070.07720.11
5.4.450.0130.07019.18
5.4.440.0100.07019.56
5.4.430.0100.05319.56
5.4.420.0130.06719.37
5.4.410.0030.06019.32
5.4.400.0170.07018.95
5.4.390.0130.05319.13
5.4.380.0130.07018.88
5.4.370.0100.07719.16
5.4.360.0130.07018.97
5.4.350.0100.06318.88
5.4.340.0100.07318.88
5.4.320.0030.07718.86
5.4.310.0130.07319.07
5.4.300.0170.05719.04
5.4.290.0030.07019.21
5.4.280.0130.07719.20
5.4.270.0200.06719.21
5.4.260.0030.07318.95
5.4.250.0030.08318.94
5.4.240.0070.08019.04
5.4.230.0030.04719.08
5.4.220.0200.06319.13
5.4.210.0070.07318.90
5.4.200.0030.07319.12
5.4.190.0100.07318.94
5.4.180.0070.07719.16
5.4.170.0070.08018.87
5.4.160.0070.07719.15
5.4.150.0130.05018.93
5.4.140.0000.08016.48
5.4.130.0000.08316.55
5.4.120.0030.07716.39
5.4.110.0100.07316.43
5.4.100.0070.07016.57
5.4.90.0070.07016.49
5.4.80.0100.06716.32
5.4.70.0100.07316.47
5.4.60.0200.04316.30
5.4.50.0100.07316.50
5.4.40.0070.07316.36
5.4.30.0000.08316.46
5.4.20.0070.07016.41
5.4.10.0170.06016.41
5.4.00.0070.07315.92
5.3.290.0100.06014.64
5.3.280.0130.07314.63
5.3.270.0100.07014.62
5.3.260.0100.03314.64
5.3.250.0030.08014.75
5.3.240.0170.06014.77
5.3.230.0100.07014.74
5.3.220.0070.07714.75
5.3.210.0070.05714.67
5.3.200.0000.08014.71
5.3.190.0100.07014.70
5.3.180.0070.07014.67
5.3.170.0030.07714.55
5.3.160.0030.07314.59
5.3.150.0030.07314.59
5.3.140.0070.07714.54
5.3.130.0170.04314.70
5.3.120.0130.07014.58
5.3.110.0070.07014.55
5.3.100.0030.06714.02
5.3.90.0070.07314.05
5.3.80.0170.05714.10
5.3.70.0100.06314.16
5.3.60.0030.08014.16
5.3.50.0030.07314.07
5.3.40.0070.07014.02
5.3.30.0100.07013.96
5.3.20.0030.07313.79
5.3.10.0070.07713.82
5.3.00.0000.08313.57

preferences:
50.75 ms | 401 KiB | 5 Q