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 "try some numbers\n"; poor_mans_strcmp(888, 888); poor_mans_strcmp(0, 0); poor_mans_strcmp(1000000, -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.70.0150.00616.88
8.3.60.0210.00016.88
8.3.50.0090.01023.00
8.3.40.0180.00319.15
8.3.30.0100.00719.12
8.3.20.0040.00420.35
8.3.10.0040.00423.55
8.3.00.0000.00819.50
8.2.180.0030.01216.63
8.2.170.0080.00822.96
8.2.160.0100.00720.24
8.2.150.0030.01224.18
8.2.140.0070.00724.66
8.2.130.0100.00326.16
8.2.120.0000.00821.12
8.2.110.0060.00321.93
8.2.100.0120.00018.18
8.2.90.0040.00419.31
8.2.80.0030.00617.97
8.2.70.0070.00317.63
8.2.60.0040.00418.05
8.2.50.0030.00618.07
8.2.40.0000.00818.41
8.2.30.0040.00418.23
8.2.20.0050.00217.66
8.2.10.0040.00418.25
8.2.00.0030.00617.80
8.1.280.0070.00725.92
8.1.270.0100.00023.89
8.1.260.0030.00526.35
8.1.250.0050.00228.09
8.1.240.0100.00722.75
8.1.230.0060.00619.67
8.1.220.0040.00417.80
8.1.210.0000.00818.77
8.1.200.0000.00817.35
8.1.190.0030.00517.23
8.1.180.0000.00818.10
8.1.170.0030.00618.56
8.1.160.0050.00222.06
8.1.150.0000.00718.95
8.1.140.0050.00217.42
8.1.130.0000.00717.93
8.1.120.0020.00517.53
8.1.110.0030.00617.48
8.1.100.0050.00217.35
8.1.90.0000.00717.50
8.1.80.0040.00417.50
8.1.70.0030.00317.47
8.1.60.0000.01117.59
8.1.50.0030.00617.48
8.1.40.0040.00417.50
8.1.30.0030.00517.67
8.1.20.0030.00517.68
8.1.10.0000.00817.65
8.1.00.0040.00417.47
8.0.300.0040.00418.77
8.0.290.0080.00016.73
8.0.280.0060.00318.48
8.0.270.0000.00717.41
8.0.260.0070.00017.30
8.0.250.0020.00516.96
8.0.240.0000.00717.09
8.0.230.0040.00416.95
8.0.220.0000.00717.00
8.0.210.0000.00716.99
8.0.200.0060.00317.04
8.0.190.0070.00017.02
8.0.180.0060.00317.07
8.0.170.0030.00517.00
8.0.160.0040.00416.85
8.0.150.0000.00716.91
8.0.140.0070.00016.96
8.0.130.0030.00613.42
8.0.120.0050.00317.02
8.0.110.0000.00717.03
8.0.100.0000.00817.11
8.0.90.0040.00417.00
8.0.80.0130.00316.95
8.0.70.0070.00016.83
8.0.60.0050.00317.07
8.0.50.0030.00616.81
8.0.30.0110.01117.22
8.0.20.0100.01417.40
8.0.10.0070.00017.01
8.0.00.0060.01616.79
7.4.330.0060.00015.01
7.4.320.0060.00016.54
7.4.300.0060.00016.55
7.4.290.0000.00716.52
7.4.280.0050.00516.57
7.4.270.0080.00016.53
7.4.260.0030.00316.57
7.4.250.0040.00416.50
7.4.240.0050.00316.53
7.4.230.0000.00716.68
7.4.220.0030.01516.49
7.4.210.0030.01116.48
7.4.200.0000.00716.63
7.4.160.0150.00616.63
7.4.150.0100.01017.40
7.4.140.0100.00817.86
7.4.130.0100.00616.47
7.4.120.0120.00616.61
7.4.110.0100.00716.57
7.4.100.0120.00616.60
7.4.90.0100.00716.44
7.4.80.0090.00916.67
7.4.70.0120.00616.64
7.4.60.0080.00916.44
7.4.50.0100.00816.49
7.4.40.0140.00616.14
7.4.30.0110.00716.03
7.4.20.0140.00316.35
7.4.10.0100.00816.20
7.4.00.0110.00416.05
7.3.330.0080.00013.40
7.3.320.0000.00713.32
7.3.310.0000.00916.29
7.3.300.0030.00316.48
7.3.290.0040.01116.47
7.3.280.0090.00816.49
7.3.270.0120.00617.40
7.3.260.0120.00816.54
7.3.250.0030.01416.50
7.3.240.0040.01416.42
7.3.230.0130.00616.44
7.3.210.0130.01316.39
7.3.200.0100.01319.39
7.3.190.0120.00616.55
7.3.180.0070.00916.35
7.3.170.0110.00816.34
7.3.160.0080.00816.41
7.3.150.0090.00916.35
7.3.140.0060.01216.24
7.3.130.0120.00616.30
7.3.120.0030.01616.34
7.3.110.0140.00316.16
7.3.100.0180.00016.36
7.3.90.0070.01116.31
7.3.80.0060.01216.20
7.3.70.0120.00616.21
7.3.60.0090.00916.20
7.3.50.0180.00016.29
7.3.40.0130.00416.21
7.3.30.0130.00416.33
7.3.20.0140.00416.34
7.3.10.0160.00316.35
7.3.00.0110.00816.35
7.2.330.0060.01116.52
7.2.320.0120.00616.87
7.2.310.0050.01316.43
7.2.300.0110.00916.49
7.2.290.0150.00316.48
7.2.280.0030.01416.57
7.2.270.0110.00716.43
7.2.260.0120.00616.53
7.2.250.0050.01516.45
7.2.240.0100.00716.52
7.2.230.0080.00916.59
7.2.220.0130.00316.41
7.2.210.0070.01116.69
7.2.200.0140.01116.55
7.2.190.0150.00316.48
7.2.180.0170.00016.30
7.2.170.0120.00616.28
7.2.160.0050.01216.49
7.2.150.0080.01016.57
7.2.140.0160.00316.38
7.2.130.0130.00516.46
7.2.120.0140.01016.46
7.2.110.0150.00416.46
7.2.100.0090.01316.54
7.2.90.0100.00716.59
7.2.80.0090.00616.58
7.2.70.0210.00416.55
7.2.60.0190.00416.64
7.2.50.0040.01316.84
7.2.40.0090.01216.67
7.2.30.0120.00616.68
7.2.20.0040.01516.38
7.2.10.0090.00916.38
7.2.00.0100.00318.08
7.1.330.0090.00815.55
7.1.320.0130.00915.44
7.1.310.0150.00415.30
7.1.300.0170.00715.46
7.1.290.0120.00915.36
7.1.280.0140.00715.42
7.1.270.0090.01515.29
7.1.260.0090.00915.48
7.1.250.0140.00315.39
7.1.240.0140.00715.49
7.1.230.0130.00715.34
7.1.220.0170.00315.33
7.1.210.0090.00615.30
7.1.200.0090.00515.58
7.1.190.0060.01115.33
7.1.180.0250.00515.46
7.1.170.0140.00315.37
7.1.160.0090.00915.25
7.1.150.0100.00715.25
7.1.140.0100.00715.57
7.1.130.0030.01215.31
7.1.120.0130.00315.32
7.1.110.0120.00415.54
7.1.100.0070.00816.77
7.1.90.0040.01315.25
7.1.80.0060.00915.47
7.1.70.0050.00716.13
7.1.60.0060.01117.40
7.1.50.0120.00816.26
7.1.40.0040.01115.29
7.1.30.0070.00715.51
7.1.20.0100.00515.37
7.1.10.0110.00315.22
7.1.00.0120.04818.87
7.0.330.0130.00414.82
7.0.320.0060.01214.95
7.0.310.0090.00615.02
7.0.300.0090.00915.00
7.0.290.0110.00714.95
7.0.280.0030.01515.16
7.0.270.0060.00914.83
7.0.260.0030.01314.91
7.0.250.0100.01015.01
7.0.240.0040.01115.02
7.0.230.0120.00414.96
7.0.220.0000.01515.08
7.0.210.0090.00614.78
7.0.200.0040.00915.88
7.0.190.0060.00915.00
7.0.180.0120.00315.00
7.0.170.0080.00814.93
7.0.160.0040.01114.95
7.0.150.0040.01215.07
7.0.140.0060.04118.60
7.0.130.0100.00515.08
7.0.120.0030.01815.16
7.0.110.0120.00915.04
7.0.100.0090.01214.87
7.0.90.0090.00615.06
7.0.80.0110.00515.06
7.0.70.0090.00615.02
7.0.60.0090.04317.63
7.0.50.0050.04716.52
7.0.40.0120.02117.45
7.0.30.0150.04317.60
7.0.20.0180.04617.53
7.0.10.0070.03717.58
7.0.00.0080.02517.63
5.6.400.0060.01415.78
5.6.390.0080.01115.77
5.6.380.0120.00615.65
5.6.370.0040.01315.81
5.6.360.0100.01315.59
5.6.350.0140.00715.98
5.6.340.0100.01015.79
5.6.330.0080.00815.71
5.6.320.0000.01615.49
5.6.310.0090.00915.86
5.6.300.0110.00615.73
5.6.290.0060.01315.69
5.6.280.0050.04218.35
5.6.270.0090.00915.90
5.6.260.0080.01015.65
5.6.250.0120.00615.87
5.6.240.0150.00315.69
5.6.230.0130.00615.70
5.6.220.0070.01115.62
5.6.210.0070.05018.23
5.6.200.0080.03416.88
5.6.190.0080.04418.16
5.6.180.0150.04918.15
5.6.170.0100.03918.04
5.6.160.0110.02018.14
5.6.150.0080.04416.95
5.6.140.0050.04617.02
5.6.130.0090.04517.00
5.6.120.0080.04318.44
5.6.110.0040.04318.47
5.6.100.0100.04418.39
5.6.90.0080.04318.36
5.6.80.0100.02017.99
5.6.70.0120.00915.67
5.6.60.0110.00715.71
5.6.50.0080.00915.86
5.6.40.0110.00715.58
5.6.30.0100.00715.69
5.6.20.0120.00615.59
5.6.10.0090.00915.59
5.6.00.0070.01015.82
5.5.380.0040.01515.57
5.5.370.0110.01115.82
5.5.360.0160.00315.70
5.5.350.0140.01917.95
5.5.340.0100.04216.79
5.5.330.0080.02817.93
5.5.320.0050.04517.99
5.5.310.0250.03317.99
5.5.300.0050.02816.96
5.5.290.0140.02516.89
5.5.280.0150.04318.20
5.5.270.0120.04618.27
5.5.260.0100.04018.21
5.5.250.0090.02618.06
5.5.240.0070.04618.05
5.5.230.0080.01215.86
5.5.220.0130.00615.67
5.5.210.0040.01515.48
5.5.200.0100.00815.64
5.5.190.0080.00915.34
5.5.180.0120.00615.65
5.5.170.0180.00015.74
5.5.160.0060.01215.89
5.5.150.0070.01015.82
5.5.140.0000.01715.63
5.5.130.0100.01315.66
5.5.120.0040.01415.67
5.5.110.0090.00915.78
5.5.100.0030.01415.53
5.5.90.0030.01515.46
5.5.80.0070.01015.50
5.5.70.0100.00815.73
5.5.60.0060.01115.63
5.5.50.0090.00915.73
5.5.40.0030.01315.75
5.5.30.0110.00615.41
5.5.20.0060.01215.73
5.5.10.0060.01215.60
5.5.00.0070.01115.45
5.4.450.0350.03315.90
5.4.440.0440.04215.86
5.4.430.0320.02816.11
5.4.420.0430.03416.15
5.4.410.0430.03615.97
5.4.400.0440.04115.76
5.4.390.0350.03015.87
5.4.380.0200.03315.54
5.4.370.0320.03215.60
5.4.360.0230.02615.68
5.4.350.0210.03115.61
5.4.340.0150.03515.58
5.4.330.0040.00812.55
5.4.320.0030.02512.50
5.4.310.0080.02112.46
5.4.300.0100.01912.50
5.4.290.0040.02512.43
5.4.280.0070.02612.46
5.4.270.0070.02712.41
5.4.260.0090.02612.46
5.4.250.0080.02612.44
5.4.240.0070.02712.45
5.4.230.0080.02912.31
5.4.220.0090.02712.63
5.4.210.0100.02612.61
5.4.200.0040.03112.38
5.4.190.0060.02112.52
5.4.180.0090.01812.43
5.4.170.0070.02012.50
5.4.160.0080.02812.46
5.4.150.0080.02812.47
5.4.140.0050.02812.39
5.4.130.0060.02212.25
5.4.120.0080.01912.40
5.4.110.0080.02212.35
5.4.100.0070.02112.33
5.4.90.0140.01912.20
5.4.80.0090.02112.30
5.4.70.0050.02212.26
5.4.60.0070.02112.34
5.4.50.0040.02412.26
5.4.40.0050.02212.25
5.4.30.0100.02212.21
5.4.20.0050.02912.40
5.4.10.0050.02112.35
5.4.00.0040.02211.99
5.3.290.0030.02613.00
5.3.280.0050.02312.87
5.3.270.0070.02212.99
5.3.260.0080.02212.98
5.3.250.0050.02312.92
5.3.240.0040.02412.83
5.3.230.0100.02412.88
5.3.220.0050.02712.90
5.3.210.0050.02612.90
5.3.200.0060.02412.83
5.3.190.0020.02712.86
5.3.180.0040.02512.91
5.3.170.0090.02512.99
5.3.160.0070.02113.07
5.3.150.0040.02512.92
5.3.140.0060.02612.90
5.3.130.0070.02212.91
5.3.120.0070.02212.88
5.3.110.0050.02312.89
5.3.100.0050.02712.69
5.3.90.0040.02812.61
5.3.80.0040.02312.60
5.3.70.0040.02412.57
5.3.60.0070.02012.74
5.3.50.0060.02212.54
5.3.40.0070.02112.57
5.3.30.0080.01912.53
5.3.20.0020.02612.39
5.3.10.0050.02212.29
5.3.00.0050.02312.35
5.2.170.0060.01810.66
5.2.160.0110.02010.65
5.2.150.0040.02510.66
5.2.140.0050.01910.66
5.2.130.0040.01910.63
5.2.120.0070.01510.60
5.2.110.0030.02110.62
5.2.100.0090.01510.69
5.2.90.0050.01910.72
5.2.80.0070.01710.57
5.2.70.0070.02610.54
5.2.60.0070.02310.57
5.2.50.0060.01810.58
5.2.40.0050.02410.53
5.2.30.0060.02510.48
5.2.20.0060.01710.47
5.2.10.0070.02210.35
5.2.00.0080.02210.38
5.1.60.0010.0249.63
5.1.50.0070.0189.53
5.1.40.0060.0199.72
5.1.30.0080.0189.83
5.1.20.0050.0229.87
5.1.10.0050.0209.66
5.1.00.0070.0209.58
5.0.50.0030.0188.41
5.0.40.0050.0178.34
5.0.30.0050.0248.25
5.0.20.0060.0178.23
5.0.10.0040.0178.22
5.0.00.0050.0228.22
4.4.90.0050.0107.46
4.4.80.0020.0147.45
4.4.70.0020.0137.45
4.4.60.0020.0137.45
4.4.50.0040.0117.46
4.4.40.0030.0157.42
4.4.30.0020.0127.45
4.4.20.0000.0137.49
4.4.10.0030.0097.50
4.4.00.0050.0127.45
4.3.110.0060.0077.40
4.3.100.0040.0097.40
4.3.90.0020.0097.39
4.3.80.0050.0137.37
4.3.70.0020.0107.38
4.3.60.0030.0087.38
4.3.50.0040.0117.38
4.3.40.0040.0137.34
4.3.30.0020.0116.74
4.3.20.0050.0106.73
4.3.10.0030.0116.71
4.3.00.0050.0208.93

preferences:
44.8 ms | 401 KiB | 5 Q