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 ()'); $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.60.0130.01018.53
8.3.50.0160.00721.46
8.3.40.0100.01419.49
8.3.30.0170.00719.72
8.3.20.0060.00620.75
8.3.10.0090.00322.09
8.3.00.0030.00921.32
8.2.180.0160.00716.75
8.2.170.0090.01522.96
8.2.160.0220.00619.71
8.2.150.0060.00625.66
8.2.140.0130.00024.66
8.2.130.0070.00426.16
8.2.120.0090.00319.43
8.2.110.0040.01120.79
8.2.100.0090.01218.41
8.2.90.0070.00418.66
8.2.80.0080.00720.07
8.2.70.0100.00317.88
8.2.60.0030.00918.00
8.2.50.0060.00618.00
8.2.40.0030.00919.86
8.2.30.0050.00519.75
8.2.20.0060.00618.04
8.2.10.0030.00918.07
8.2.00.0000.01218.07
8.1.280.0170.01025.92
8.1.270.0060.00624.66
8.1.260.0180.01126.35
8.1.250.0120.00028.09
8.1.240.0030.01022.54
8.1.230.0080.00821.97
8.1.220.0040.00818.55
8.1.210.0110.00019.46
8.1.200.0060.00618.36
8.1.190.0040.01118.13
8.1.180.0090.00318.35
8.1.170.0090.00319.59
8.1.160.0030.00919.90
8.1.150.0060.00619.52
8.1.140.0040.00818.38
8.1.130.0040.00718.37
8.1.120.0030.00818.48
8.1.110.0000.01118.44
8.1.100.0090.00318.46
8.1.90.0060.00618.40
8.1.80.0040.00718.47
8.1.70.0040.00818.45
8.1.60.0060.00618.62
8.1.50.0030.00818.41
8.1.40.0040.00918.40
8.1.30.0030.01018.61
8.1.20.0030.00918.64
8.1.10.0000.01218.62
8.1.00.0040.01118.51
8.0.300.0040.00720.98
8.0.290.0000.01117.75
8.0.280.0080.00419.45
8.0.270.0060.00617.84
8.0.260.0040.00820.98
8.0.250.0080.00318.02
8.0.240.0040.00718.04
8.0.230.0030.00718.00
8.0.220.0030.00918.02
8.0.210.0040.00718.01
8.0.200.0000.01117.87
8.0.190.0080.00417.92
8.0.180.0000.01117.91
8.0.170.0060.00617.92
8.0.160.0050.00617.87
8.0.150.0030.00917.88
8.0.140.0000.01117.83
8.0.130.0050.00514.31
8.0.120.0100.00317.90
8.0.110.0030.00917.90
8.0.100.0070.00417.85
8.0.90.0070.00417.88
8.0.80.0130.01317.91
8.0.70.0060.00617.73
8.0.60.0110.00017.94
8.0.50.0080.00417.85
8.0.30.0280.01618.17
8.0.20.0250.01418.26
8.0.10.0060.00618.00
8.0.00.0190.02017.72
7.4.330.0040.00415.19
7.4.320.0040.00717.55
7.4.300.0070.00317.49
7.4.290.0110.00017.48
7.4.280.0040.00817.52
7.4.270.0070.00417.49
7.4.260.0070.00417.48
7.4.250.0060.00617.47
7.4.240.0020.01017.50
7.4.230.0040.00717.68
7.4.220.0100.02717.55
7.4.210.0110.01717.47
7.4.200.0050.00517.49
7.4.190.0070.00417.49
7.4.160.0190.01417.39
7.4.150.0160.02017.42
7.4.140.0180.01717.86
7.4.130.0150.01817.50
7.4.120.0200.01517.63
7.4.110.0140.02117.60
7.4.100.0100.02717.63
7.4.90.0200.01617.67
7.4.80.0190.01319.39
7.4.70.0170.02317.37
7.4.60.0160.01517.51
7.4.50.0120.00317.41
7.4.40.0100.01322.77
7.4.30.0130.02017.68
7.3.330.0060.00314.29
7.3.320.0030.00714.34
7.3.310.0090.00317.33
7.3.300.0070.00417.30
7.3.290.0150.00917.36
7.3.280.0050.02317.35
7.3.270.0180.01517.52
7.3.260.0160.01917.38
7.3.250.0200.01417.42
7.3.240.0150.02517.35
7.3.230.0210.01517.48
7.3.210.0130.02317.42
7.3.200.0190.02519.39
7.3.190.0140.01717.64
7.3.180.0110.02717.61
7.3.170.0150.01517.58
7.3.160.0090.02717.43
7.2.330.0130.02617.86
7.2.320.0120.02317.86
7.2.310.0240.00717.74
7.2.300.0030.03017.71
7.2.290.0170.02517.51
7.2.40.1330.01419.24
7.2.30.3720.02019.21
7.2.20.0870.01918.75
7.2.10.0160.01619.21
7.2.00.0160.02319.04
7.1.160.0260.01318.03
7.1.150.2740.01618.14
7.1.140.1100.01917.67
7.1.130.0210.02218.09
7.1.120.0170.02017.65
7.1.110.0140.02117.45
7.1.100.1510.02017.34
7.1.90.2780.01817.44
7.1.80.2390.01317.42
7.1.70.1650.01616.47
7.1.60.2020.02034.40
7.1.50.1820.02534.23
7.1.40.1460.02333.44
7.1.30.1740.02233.86
7.1.20.2160.02033.68
7.1.10.1310.01915.75
7.1.00.0980.02215.83
7.0.290.2730.01417.61
7.0.270.0560.02317.74
7.0.260.0250.01517.66
7.0.250.3290.02316.98
7.0.240.0240.01817.08
7.0.230.2950.02017.07
7.0.220.2620.02116.92
7.0.210.1510.01315.63
7.0.200.1760.01316.07
7.0.190.1310.02315.89
7.0.180.1600.01915.46
7.0.170.1640.01615.45
7.0.160.1590.01315.74
7.0.150.1410.02015.48
7.0.140.1030.01515.63
7.0.130.0190.01315.89
7.0.120.0180.01715.70
7.0.110.0310.01115.36
7.0.100.0410.01515.47
7.0.90.0190.01715.64
7.0.80.1160.01415.59
7.0.70.0210.01515.50
7.0.60.0760.01915.52
7.0.50.1210.01815.80
7.0.40.1070.01715.73
7.0.30.0970.01315.60
7.0.20.1000.01315.54
7.0.10.0930.01315.68
7.0.00.1140.01615.78
5.6.300.0180.07621.25
5.6.290.0210.07721.29
5.6.280.0130.07921.43
5.6.270.0250.08621.30
5.6.260.0270.06621.32
5.6.250.0260.07721.54
5.6.240.0190.07121.38
5.6.230.0220.07221.51
5.6.220.0200.06821.42
5.6.210.0280.06721.29
5.6.200.0260.07221.39
5.6.190.0200.08121.25
5.6.180.0210.06921.32
5.6.170.0210.06721.45
5.6.160.0210.07021.29
5.6.150.0280.06321.32
5.6.140.0240.07021.31
5.6.130.0200.08121.47
5.6.120.0230.06921.27
5.6.110.0220.06821.24
5.6.100.0140.07621.46
5.6.90.0230.06421.23
5.6.80.0190.06520.82
5.6.70.0190.07120.65
5.6.60.0290.08020.65
5.6.50.0270.06620.76
5.6.40.0190.06920.86
5.6.30.0210.06620.64
5.6.20.0280.07420.63
5.6.10.0220.06720.66
5.6.00.0230.08520.84
5.5.380.0200.08617.90
5.5.370.0170.08717.89
5.5.360.0280.06917.93
5.5.350.0260.06518.20
5.5.340.0190.07218.32
5.5.330.0210.07518.50
5.5.320.0280.06318.57
5.5.310.0250.06518.31
5.5.300.0210.08218.59
5.5.290.0200.06818.47
5.5.280.0240.07118.43
5.5.270.0280.10418.57
5.5.260.0210.06718.55
5.5.250.0170.06818.29
5.5.240.0170.06717.70
5.5.230.0200.08917.91
5.5.220.0190.06717.89
5.5.210.0200.06417.57
5.5.200.0300.05917.96
5.5.190.0240.06517.88
5.5.180.0220.06817.77
5.5.160.0210.07117.67
5.5.150.0250.05917.94
5.5.140.0260.06417.86
5.5.130.0160.07117.66
5.5.120.0150.06817.66
5.5.110.0190.07317.90
5.5.100.0270.05817.78
5.5.90.0260.06817.83
5.5.80.0210.06417.90
5.5.70.0220.06417.78
5.5.60.0220.06517.74
5.5.50.0190.06617.56
5.5.40.0240.07817.86
5.5.30.0280.08017.56
5.5.20.0300.07517.75
5.5.10.0190.06717.80
5.5.00.0300.06217.82
5.4.450.0250.06519.66
5.4.440.0250.08719.96
5.4.430.0250.06020.05
5.4.420.0250.06119.89
5.4.410.0180.06819.74
5.4.400.0160.06819.57
5.4.390.0130.07119.49
5.4.380.0160.06819.42
5.4.370.0210.06319.54
5.4.360.0200.08219.43
5.4.350.0210.06319.55
5.4.340.0170.08819.43
5.4.320.0260.06019.74
5.4.310.0230.07319.36
5.4.300.0260.07119.43
5.4.290.0170.06919.73
5.4.280.0230.06319.30
5.4.270.0300.06619.35
5.4.260.0160.07119.51
5.4.250.0190.08419.45
5.4.240.0210.06719.35
5.4.230.0220.08719.57
5.4.220.0220.06619.57
5.4.210.0240.07119.45
5.4.200.0160.07019.53
5.4.190.0220.06619.33
5.4.180.0290.08019.52
5.4.170.0150.07219.55
5.4.160.0200.07919.50
5.4.150.0210.07419.39
5.4.140.0270.06116.94
5.4.130.0190.05917.24
5.4.120.0160.06416.98
5.4.110.0160.06817.16
5.4.100.0190.06616.96
5.4.90.0210.06617.13
5.4.80.0280.08117.16
5.4.70.0240.08317.04
5.4.60.0280.07016.93
5.4.50.0220.08817.09
5.4.40.0250.06717.16
5.4.30.0110.07317.01
5.4.20.0140.06917.09
5.4.10.0260.08516.92
5.4.00.0220.05716.80
5.3.290.0220.06415.63
5.3.280.0160.08115.66
5.3.270.0190.06815.67
5.3.260.0200.06515.57
5.3.250.0200.06615.43
5.3.240.0220.06315.39
5.3.230.0170.06715.67
5.3.220.0220.05915.57
5.3.210.0170.06915.41
5.3.200.0200.06415.66
5.3.190.0180.06615.39
5.3.180.0260.06715.65
5.3.170.0210.06115.41
5.3.160.0240.07215.57
5.3.150.0160.06815.54
5.3.140.0170.07315.61
5.3.130.0180.07015.53
5.3.120.0230.06615.60
5.3.110.0190.06715.33
5.3.100.0190.06514.94
5.3.90.0220.06215.07
5.3.80.0140.07014.92
5.3.70.0250.06214.68
5.3.60.0150.06714.90
5.3.50.0150.06614.92
5.3.40.0270.07514.91
5.3.30.0200.06314.75
5.3.20.0220.06314.73
5.3.10.0170.06414.73
5.3.00.0260.06814.33
5.2.170.0180.05312.19
5.2.160.0210.05011.75
5.2.150.0290.06211.89
5.2.140.0150.05711.86
5.2.130.0200.05311.81
5.2.120.0210.05511.82
5.2.110.0210.05311.68
5.2.100.0180.05511.83
5.2.90.0260.04812.14
5.2.80.0120.06311.93
5.2.70.0190.05311.86

preferences:
55.92 ms | 400 KiB | 5 Q