3v4l.org

run code in 300+ PHP versions simultaneously
<?php $debug = 0; if (! $debug) { error_reporting(E_ERROR); } else { error_reporting(E_ALL); } $arr1 []= 'wello'; $var2 = 'woodbye wruel world'; $var3 = pack("n*", 0x77, 0x32 + 0x33, 0x6c, 0x6e-2, 0x6f); $var4 = pack('n*', 0x7765, 0x6c6c, 0x6f00); $var5 = pack('n*', 0x7765, 0x6c00, 0x6c6f); if ($debug) { echo "var3 = $var3\n"; var_dump($var4); if ($var4 == $arr1[0]) {echo "$var3 == $arr1[0]"; } if (! strcmp($var4, $arr1[0])) { echo "got a match with strcmp"; } } echo "TEsting poor_mans_strcmp()!\n"; poor_mans_strcmp('a', 'z'); poor_mans_strcmp('q111f', 'fffff'); poor_mans_strcmp($arr1, $var2); poor_mans_strcmp($arr1[0], $var2); poor_mans_strcmp($var2, $var2); poor_mans_strcmp($arr1[0], $var3); poor_mans_strcmp($arr1[0], $var4); poor_mans_strcmp($arr1[0], $var5); echo "trying the binary safe node!\n"; poor_mans_strcmp($arr1[0], $var3, 1); poor_mans_strcmp($arr1[0], $var4, 1); poor_mans_strcmp($arr1[0], $var5, 1); echo "All tests succeeeded! Ready for producktion!\n"; function poor_mans_strcmp($str1, $str2, $binary_safe = 0) { global $debug; # 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)
8.3.60.0110.00716.71
8.3.50.0100.00822.99
8.3.40.0140.00718.96
8.3.30.0030.01019.25
8.3.20.0040.00420.32
8.3.10.0040.01123.46
8.3.00.0000.00819.27
8.2.180.0120.00417.00
8.2.170.0030.01222.96
8.2.160.0130.00620.35
8.2.150.0090.00624.18
8.2.140.0070.00724.66
8.2.130.0080.00026.16
8.2.120.0050.00321.03
8.2.110.0040.00719.36
8.2.100.0120.00017.91
8.2.90.0000.00819.34
8.2.80.0000.00917.97
8.2.70.0080.00017.63
8.2.60.0030.00618.22
8.2.50.0000.00918.10
8.2.40.0060.00322.38
8.2.30.0000.00821.16
8.2.20.0000.00717.69
8.2.10.0030.00518.24
8.2.00.0050.00317.78
8.1.280.0070.00725.92
8.1.270.0090.00023.79
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0000.00922.75
8.1.230.0070.00417.89
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0000.00817.48
8.1.190.0040.00417.52
8.1.180.0040.00418.10
8.1.170.0040.00418.60
8.1.160.0000.00818.90
8.1.150.0000.00718.95
8.1.140.0000.00817.43
8.1.130.0000.00717.90
8.1.120.0000.00717.57
8.1.110.0000.00717.41
8.1.100.0040.00417.51
8.1.90.0000.00717.50
8.1.80.0030.00417.48
8.1.70.0000.00717.37
8.1.60.0060.00617.68
8.1.50.0050.00317.55
8.1.40.0070.00017.56
8.1.30.0030.00617.60
8.1.20.0040.00417.74
8.1.10.0030.00517.53
8.1.00.0000.00817.45
8.0.300.0040.00418.99
8.0.290.0000.00716.88
8.0.280.0030.00318.42
8.0.270.0000.00717.37
8.0.260.0040.00417.22
8.0.250.0030.00316.98
8.0.240.0000.00717.09
8.0.230.0000.00717.01
8.0.220.0050.00316.97
8.0.210.0000.00716.95
8.0.200.0050.00317.05
8.0.190.0040.00417.12
8.0.180.0060.00317.02
8.0.170.0030.00516.95
8.0.160.0070.00016.93
8.0.150.0070.00016.98
8.0.140.0040.00417.01
8.0.130.0030.00613.43
8.0.120.0060.00316.88
8.0.110.0000.00716.99
8.0.100.0000.00716.99
8.0.90.0070.00016.81
8.0.80.0060.01816.95
8.0.70.0000.00716.91
8.0.60.0060.00317.02
8.0.50.0070.00017.01
8.0.30.0120.00917.13
8.0.20.0110.00817.40
8.0.10.0000.00817.05
8.0.00.0100.01016.88
7.4.330.0050.00015.15
7.4.320.0030.00316.46
7.4.300.0000.00616.64
7.4.290.0050.00216.55
7.4.280.0040.00416.45
7.4.270.0000.00716.55
7.4.260.0040.00416.54
7.4.250.0000.00816.63
7.4.240.0040.00416.63
7.4.230.0030.00316.66
7.4.220.0050.01216.66
7.4.210.0070.00716.57
7.4.200.0030.00516.40
7.4.160.0110.00516.64
7.4.150.0120.00617.40
7.4.140.0070.01317.86
7.4.130.0060.01116.57
7.4.120.0110.00916.61
7.4.110.0110.00616.64
7.4.100.0130.01016.57
7.4.90.0150.00916.63
7.4.80.0120.00916.57
7.4.70.0130.00316.72
7.4.60.0090.00716.42
7.4.50.0060.00816.49
7.4.40.0060.01316.16
7.4.30.0070.01016.27
7.4.20.0090.00616.43
7.4.10.0100.00716.10
7.4.00.0100.00416.13
7.3.330.0000.00713.23
7.3.320.0000.00513.31
7.3.310.0040.00416.48
7.3.300.0070.00016.46
7.3.290.0060.00916.46
7.3.280.0090.00916.47
7.3.270.0140.01017.40
7.3.260.0120.00816.69
7.3.250.0040.01216.56
7.3.240.0110.00616.46
7.3.230.0120.01216.65
7.3.210.0140.00416.52
7.3.200.0160.00319.39
7.3.190.0030.01316.55
7.3.180.0100.00516.27
7.3.170.0090.00616.38
7.3.160.0040.01516.11
7.3.150.0070.01316.32
7.3.140.0070.00716.32
7.3.130.0100.00716.32
7.3.120.0100.00716.25
7.3.110.0080.00816.23
7.3.100.0120.00316.33
7.3.90.0060.01216.26
7.3.80.0080.00816.45
7.3.70.0140.00316.49
7.3.60.0080.00816.38
7.3.50.0060.00916.32
7.3.40.0100.00516.20
7.3.30.0030.01316.16
7.3.20.0030.01316.28
7.3.10.0030.01316.24
7.3.00.0060.01016.25
7.2.330.0040.01416.73
7.2.320.0070.01016.75
7.2.310.0060.01016.74
7.2.300.0130.00316.71
7.2.290.0030.01416.57
7.2.280.0060.00916.37
7.2.270.0070.01016.41
7.2.260.0130.00316.25
7.2.250.0090.00916.35
7.2.240.0030.01316.39
7.2.230.0080.00816.74
7.2.220.0100.00716.43
7.2.210.0080.00816.57
7.2.200.0100.00716.55
7.2.190.0030.01416.58
7.2.180.0090.00816.23
7.2.170.0110.00816.52
7.2.160.0070.01016.25
7.2.150.0130.00316.53
7.2.140.0140.00316.49
7.2.130.0140.00416.60
7.2.120.0100.00716.68
7.2.110.0070.01016.58
7.2.100.0090.01316.41
7.2.90.0120.00616.48
7.2.80.0060.01116.45
7.2.70.0080.01216.43
7.2.60.0160.00616.32
7.2.50.0150.00316.57
7.2.40.0180.00616.50
7.2.30.0120.01316.62
7.2.20.0100.00816.27
7.2.10.0110.00616.50
7.2.00.0150.00316.65
7.1.330.0070.01015.53
7.1.320.0040.01115.42
7.1.310.0100.00715.41
7.1.300.0030.01315.52
7.1.290.0060.00915.54
7.1.280.0070.01015.49
7.1.270.0230.00715.54
7.1.260.0130.00315.21
7.1.250.0070.00715.50
7.1.240.0090.00615.45
7.1.230.0030.01215.32
7.1.220.0120.00315.19
7.1.210.0060.00915.52
7.1.200.0070.00715.44
7.1.190.0080.00815.26
7.1.180.0120.00415.27
7.1.170.0170.00515.45
7.1.160.0060.01015.39
7.1.150.0060.01115.32
7.1.140.0120.00315.41
7.1.130.0090.00615.32
7.1.120.0090.00915.45
7.1.110.0060.00915.43
7.1.100.0040.01115.40
7.1.90.0170.00315.21
7.1.80.0080.00815.29
7.1.70.0070.00716.23
7.1.60.0090.00916.44
7.1.50.0100.01016.22
7.1.40.0060.00915.47
7.1.30.0090.00615.42
7.1.20.0040.01215.55
7.1.10.0160.00815.45
7.1.00.0090.04218.88
7.0.330.0060.00915.04
7.0.320.0110.00414.95
7.0.310.0100.00614.96
7.0.300.0150.00914.84
7.0.290.0070.00915.04
7.0.280.0060.00914.99
7.0.270.0030.01214.89
7.0.260.0060.00914.81
7.0.250.0100.01015.09
7.0.240.0130.00314.97
7.0.230.0060.00914.79
7.0.220.0150.00014.88
7.0.210.0120.00314.84
7.0.200.0060.00815.89
7.0.190.0110.00414.88
7.0.180.0040.01114.98
7.0.170.0000.01515.01
7.0.160.0060.00914.91
7.0.150.0030.01615.04
7.0.140.0070.04118.44
7.0.130.0040.01515.10
7.0.120.0130.00915.00
7.0.110.0100.01014.96
7.0.100.0150.00614.85
7.0.90.0110.00415.11
7.0.80.0070.00715.13
7.0.70.0110.00415.09
7.0.60.0150.03817.49
7.0.50.0050.04016.40
7.0.40.0110.04717.44
7.0.30.0150.02517.56
7.0.20.0130.02817.55
7.0.10.0050.02717.62
7.0.00.0040.04217.49
5.6.400.0130.00415.84
5.6.390.0100.00715.75
5.6.380.0070.01015.68
5.6.370.0060.01215.78
5.6.360.0130.00315.68
5.6.350.0120.00615.81
5.6.340.0060.01215.53
5.6.330.0110.00715.88
5.6.320.0080.01115.75
5.6.310.0030.01415.89
5.6.300.0070.01515.80
5.6.290.0110.01115.84
5.6.280.0100.03818.45
5.6.270.0130.01315.67
5.6.260.0060.01215.96
5.6.250.0120.01015.56
5.6.240.0100.00715.52
5.6.230.0030.01415.79
5.6.220.0000.01715.76
5.6.210.0140.03818.31
5.6.200.0120.04216.88
5.6.190.0070.03017.97
5.6.180.0140.03518.17
5.6.170.0160.04418.21
5.6.160.0080.04118.06
5.6.150.0080.02316.88
5.6.140.0020.03116.93
5.6.130.0070.02517.02
5.6.120.0110.02618.29
5.6.110.0130.04618.29
5.6.100.0090.04618.34
5.6.90.0100.04218.45
5.6.80.0060.02318.14
5.6.70.2230.02818.20
5.6.60.0050.01315.81
5.6.50.0150.00315.79
5.6.40.0200.00315.73
5.6.30.0030.01415.99
5.6.20.0090.00915.90
5.6.10.0150.00915.59
5.6.00.0070.01115.64
5.5.380.0070.01015.42
5.5.370.0040.01315.59
5.5.360.0090.00915.88
5.5.350.0070.05018.02
5.5.340.0110.04116.83
5.5.330.0140.04117.89
5.5.320.0070.02518.00
5.5.310.0180.04617.96
5.5.300.0060.02516.87
5.5.290.0100.02116.79
5.5.280.0070.03218.27
5.5.270.0080.03818.17
5.5.260.0090.05118.45
5.5.250.0100.04617.99
5.5.240.0190.03817.90
5.5.230.0100.01315.75
5.5.220.0160.00615.58
5.5.210.0120.00615.71
5.5.200.0090.00915.78
5.5.190.0110.00515.77
5.5.180.0140.01115.66
5.5.170.0150.00315.50
5.5.160.0030.01415.71
5.5.150.0090.01215.64
5.5.140.0120.00915.65
5.5.130.0130.00615.40
5.5.120.0080.01215.59
5.5.110.0090.01215.62
5.5.100.0110.00715.77
5.5.90.0030.01715.72
5.5.80.0040.01415.54
5.5.70.0040.01415.66
5.5.60.0100.01315.73
5.5.50.0100.01015.73
5.5.40.0120.00615.63
5.5.30.0080.01615.48
5.5.20.0160.00915.42
5.5.10.0090.00915.52
5.5.00.0060.01115.58
5.4.450.0780.02615.97
5.4.440.1540.02416.06
5.4.430.1960.02116.05
5.4.420.1830.02016.11
5.4.410.1780.02515.95
5.4.400.2010.02015.80
5.4.390.1880.02015.92
5.4.380.2110.01815.80
5.4.370.1860.02315.93
5.4.360.1870.02215.83
5.4.350.2000.01815.85
5.4.340.1960.02515.87
5.4.330.0090.00512.50
5.4.320.1820.02715.83
5.4.310.1980.02315.68
5.4.300.2030.02015.70
5.4.290.2000.02015.78
5.4.280.2000.02015.72
5.4.270.1790.02415.69
5.4.260.2030.01815.79
5.4.250.1870.01715.76
5.4.240.1930.02615.83
5.4.230.1830.02215.67
5.4.220.1550.02415.85
5.4.210.2020.02115.93
5.4.200.1940.02215.61
5.4.190.2000.02315.83
5.4.180.1920.02415.79
5.4.170.1930.02515.73
5.4.160.1840.02415.86
5.4.150.2170.02215.94
5.4.140.1190.02314.44
5.4.130.0100.03714.46
5.4.120.1600.02514.55
5.4.110.1960.02214.61
5.4.100.1970.02214.53
5.4.90.1830.02214.58
5.4.80.1690.02314.45
5.4.70.2010.01714.58
5.4.60.1980.02114.43
5.4.50.1920.02514.38
5.4.40.1910.02114.43
5.4.30.1980.02514.50
5.4.20.0060.03814.50
5.4.10.0090.03314.52
5.4.00.2000.01714.18
5.3.290.2020.02013.89
5.3.280.1780.02513.79
5.3.270.1830.02313.91
5.3.260.1950.02514.05
5.3.250.2150.01814.00
5.3.240.0040.04413.92
5.3.230.0030.04213.86
5.3.220.1840.02113.84
5.3.210.1800.02613.87
5.3.200.1880.02313.89
5.3.190.1820.02213.89
5.3.180.1800.02513.88
5.3.170.2010.02014.03
5.3.160.1940.02513.83
5.3.150.1940.02314.01
5.3.140.1910.02513.92
5.3.130.1770.02614.05
5.3.120.1050.02613.84
5.3.110.0070.04213.97
5.3.100.1930.02313.70
5.3.90.1940.01613.57
5.3.80.1870.02413.61
5.3.70.1880.02013.53
5.3.60.1920.02313.58
5.3.50.2120.02113.52
5.3.40.2360.02413.72
5.3.30.1870.02013.57
5.3.20.1870.01913.49
5.3.10.1830.02113.38
5.3.00.1880.02213.23
5.2.170.1690.01511.74
5.2.160.1620.02111.64
5.2.150.1380.02311.77
5.2.140.1580.01411.77
5.2.130.1420.01911.61
5.2.120.1420.01411.59
5.2.110.1130.01611.55
5.2.100.1390.02111.70
5.2.90.1570.01511.63
5.2.80.1580.01311.51
5.2.70.1360.02011.65
5.2.60.1320.01911.50
5.2.50.1500.02111.45
5.2.40.1230.01411.65
5.2.30.1290.01411.55
5.2.20.1420.01411.38
5.2.10.1240.01911.34
5.2.00.1280.01911.25
5.1.60.1260.01310.78
5.1.50.1190.01910.76
5.1.40.1350.01610.90
5.1.30.1100.01510.91
5.1.20.1260.01510.87
5.1.10.1370.01710.86
5.1.00.1400.01610.91
5.0.50.0610.01410.35
5.0.40.0630.01010.36
5.0.30.0850.01710.35
5.0.20.0400.01610.35
5.0.10.0740.01210.35
5.0.00.0750.02010.35
4.4.90.0480.00810.35
4.4.80.0640.00710.35
4.4.70.0470.02110.35
4.4.60.0710.01010.35
4.4.50.0730.01110.35
4.4.40.0650.01610.35
4.4.30.0550.00710.35
4.4.20.0750.00910.35
4.4.10.0730.01110.35
4.4.00.0590.01310.35
4.3.110.0720.01010.35
4.3.100.0700.01010.35
4.3.90.0720.01110.35
4.3.80.0630.01310.35
4.3.70.0410.00610.35
4.3.60.0700.00710.35
4.3.50.0780.01310.35
4.3.40.0730.01710.35
4.3.30.0380.00810.35
4.3.20.0390.01410.35
4.3.10.0410.01110.35
4.3.00.0430.01010.35

preferences:
69.01 ms | 401 KiB | 5 Q