3v4l.org

run code in 300+ PHP versions simultaneously
<?php global $debug = 0; $arr1 []= 'wello'; $var2 = 'woodbye wruel world'; $var3 = pack("n*", 0x77, 0x32 + 0x33, 0x6c, 0x6e-2, 0x6f); $var4 = pack('n*', 0x7765, 0x6c6c, 0x6f00); echo "var3 = $var3"; var_dump($var4); if ($var4 == $arr1[0]) {echo "$var3 == $arr1[0]"; } if (! strcmp($var4, $arr1[0])) { echo "got a match with strcmp"; } var_dump(poor_mans_strcmp('a', 'z')); var_dump(poor_mans_strcmp('q111f', 'fffff')); var_dump(poor_mans_strcmp($arr1, $var2)); var_dump(poor_mans_strcmp($arr1[0], $var2)); var_dump(poor_mans_strcmp($var2, $var2)); var_dump(poor_mans_strcmp($arr1[0], $var3)); var_dump(poor_mans_strcmp($arr1[0], $var4)); echo "trying the binary safe node!\n"; var_dump(poor_mans_strcmp($arr1[0], $var3, 1)); var_dump(poor_mans_strcmp($arr1[0], $var4, 1)); function poor_mans_strcmp($str1, $str2, $binary_safe = 0) { # use old shell programming trick $str3 = 'a' . $str1; $str4 = 'a' . $str2; if ($binary_safe) { # strip null bytes to make it binary safe! $str3 = str_replace(chr(0), '', $str3); $str4 = str_replace(chr(0), '', $str4); } if ($debug) {var_dump($str3, $str4);} $result = 0; if ($str3 < $str4) { echo "$str1 is LESSTHAN $str2\n"; $result = -1; } if ($str3 > $str4) { if ($result == -1) {echo "Serious error detected, keep on trucking!\n";} $result = 1; echo "$str1 is GREATERTHAN $str2\n"; } if ($result == 0) {echo "MATCH: $str1 with $str2\n";} return $result; }

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)
5.4.320.0090.04712.50
5.4.310.0090.03612.49
5.4.300.0080.03512.50
5.4.290.0050.03912.49
5.4.280.0080.03212.39
5.4.270.0040.03812.39
5.4.260.0070.03812.39
5.4.250.0060.03812.39
5.4.240.0070.03512.39
5.4.230.0040.03912.38
5.4.220.0070.03612.38
5.4.210.0040.03712.38
5.4.200.0090.03512.38
5.4.190.0060.03612.38
5.4.180.0050.03712.38
5.4.170.0060.03612.38
5.4.160.0030.04012.38
5.4.150.0090.03412.38
5.4.140.0060.03712.07
5.4.130.0070.03412.05
5.4.120.0050.03512.02
5.4.110.0050.03512.01
5.4.100.0090.03112.01
5.4.90.0080.04412.01
5.4.80.0070.03512.01
5.4.70.0070.03512.00
5.4.60.0060.03612.00
5.4.50.0080.03412.00
5.4.40.0080.03312.00
5.4.30.0040.03811.99
5.4.20.0040.03711.98
5.4.10.0030.03711.99
5.4.00.0050.03611.48
5.3.290.0090.04212.80
5.3.280.0100.03512.70
5.3.270.0060.04012.72
5.3.260.0090.03612.71
5.3.250.0090.04212.72
5.3.240.0050.03812.72
5.3.230.0050.03812.71
5.3.220.0050.03712.68
5.3.210.0050.03912.68
5.3.200.0030.03912.68
5.3.190.0060.03712.68
5.3.180.0030.04712.68
5.3.170.0100.03412.67
5.3.160.0070.03712.67
5.3.150.0080.03512.67
5.3.140.0080.03612.66
5.3.130.0060.04812.66
5.3.120.0050.04512.65
5.3.110.0070.03812.66
5.3.100.0060.03712.12
5.3.90.0060.03612.08
5.3.80.0090.04912.07
5.3.70.0110.04412.08
5.3.60.0050.03712.06
5.3.50.0040.03912.00
5.3.40.0050.03812.00
5.3.30.0050.03611.95
5.3.20.0080.03411.72
5.3.10.0070.03511.70
5.3.00.0050.03811.68
5.2.170.0040.0329.18
5.2.160.0060.0299.18
5.2.150.0060.0299.18
5.2.140.0040.0319.18
5.2.130.0020.0329.14
5.2.120.0040.0299.14
5.2.110.0060.0289.14
5.2.100.0060.0279.14
5.2.90.0040.0299.14
5.2.80.0040.0319.14
5.2.70.0050.0309.14
5.2.60.0050.0309.09
5.2.50.0040.0409.07
5.2.40.0080.0279.04
5.2.30.0060.0309.01
5.2.20.0040.0319.00
5.2.10.0090.0248.93
5.2.00.0070.0398.79
5.1.60.0060.0278.07
5.1.50.0070.0298.07
5.1.40.0050.0248.04
5.1.30.0020.0278.40
5.1.20.0070.0238.42
5.1.10.0050.0258.14
5.1.00.0020.0278.14
5.0.50.0030.0216.62
5.0.40.0050.0186.49
5.0.30.0060.0286.29
5.0.20.0040.0206.26
5.0.10.0050.0196.25
5.0.00.0040.0316.23
4.4.90.0070.0174.78
4.4.80.0020.0174.76
4.4.70.0030.0154.75
4.4.60.0030.0144.75
4.4.50.0040.0144.77
4.4.40.0020.0264.71
4.4.30.0040.0144.76
4.4.20.0020.0164.84
4.4.10.0040.0144.85
4.4.00.0030.0254.76
4.3.110.0020.0164.67
4.3.100.0010.0174.66
4.3.90.0030.0144.64
4.3.80.0030.0244.58
4.3.70.0010.0164.63
4.3.60.0020.0154.63
4.3.50.0040.0144.63
4.3.40.0030.0244.54
4.3.30.0020.0163.29
4.3.20.0020.0173.27
4.3.10.0040.0183.22
4.3.00.0030.01318.23

preferences:
140.95 ms | 1394 KiB | 7 Q