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 "Arrays\n"; $arr2[]= "lolphp"; poor_mans_strcmp($arr1, $arr2); poor_mans_strcmp($arr2, $arr2); 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.0110.01117.00
8.3.60.0140.00716.88
8.3.50.0120.00722.93
8.3.40.0090.00618.96
8.3.30.0070.01119.19
8.3.20.0070.00020.33
8.3.10.0060.00323.61
8.3.00.0050.00319.38
8.2.180.0090.00618.29
8.2.170.0120.00622.96
8.2.160.0150.00620.28
8.2.150.0050.00324.18
8.2.140.0150.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00420.98
8.2.110.0030.00720.42
8.2.100.0000.01118.22
8.2.90.0050.00319.30
8.2.80.0000.00817.97
8.2.70.0120.00017.36
8.2.60.0040.00418.02
8.2.50.0030.00618.07
8.2.40.0040.00418.34
8.2.30.0000.00818.06
8.2.20.0080.00017.66
8.2.10.0070.00018.17
8.2.00.0040.00417.88
8.1.280.0130.01025.92
8.1.270.0100.00723.80
8.1.260.0120.00626.35
8.1.250.0050.00328.09
8.1.240.0040.00423.81
8.1.230.0070.00419.09
8.1.220.0040.00417.91
8.1.210.0080.00018.77
8.1.200.0100.00017.23
8.1.190.0000.00817.23
8.1.180.0030.00618.10
8.1.170.0080.00018.59
8.1.160.0030.00621.93
8.1.150.0040.00418.91
8.1.140.0040.00417.43
8.1.130.0050.00217.87
8.1.120.0070.00017.43
8.1.110.0040.00417.39
8.1.100.0040.00417.38
8.1.90.0050.00217.39
8.1.80.0000.00717.41
8.1.70.0030.00317.39
8.1.60.0040.00717.60
8.1.50.0040.00417.53
8.1.40.0040.00417.57
8.1.30.0050.00317.52
8.1.20.0000.00817.73
8.1.10.0000.00717.50
8.1.00.0040.00417.52
8.0.300.0080.00018.77
8.0.290.0000.00816.88
8.0.280.0000.00818.45
8.0.270.0000.00717.21
8.0.260.0000.00817.30
8.0.250.0030.00317.09
8.0.240.0070.00016.95
8.0.230.0030.00317.00
8.0.220.0000.00717.06
8.0.210.0070.00017.04
8.0.200.0040.00416.93
8.0.190.0000.00717.06
8.0.180.0040.00417.01
8.0.170.0050.00216.95
8.0.160.0040.00416.92
8.0.150.0040.00416.95
8.0.140.0040.00416.90
8.0.130.0070.00013.43
8.0.120.0080.00016.93
8.0.110.0040.00416.95
8.0.100.0000.00716.91
8.0.90.0040.00416.85
8.0.80.0060.00916.99
8.0.70.0000.00716.83
8.0.60.0040.00416.94
8.0.50.0030.00616.91
8.0.30.0130.00917.16
8.0.20.0110.00717.40
8.0.10.0050.00216.96
8.0.00.0060.01216.67
7.4.330.0000.00515.20
7.4.320.0000.00716.56
7.4.300.0040.00416.54
7.4.290.0000.00716.66
7.4.280.0060.00316.39
7.4.270.0030.00316.69
7.4.260.0030.00316.52
7.4.250.0000.00816.61
7.4.240.0070.00016.64
7.4.230.0030.00316.68
7.4.220.0180.00416.58
7.4.210.0130.00716.45
7.4.200.0000.00716.75
7.4.160.0080.01216.43
7.4.150.0140.00417.40
7.4.140.0060.01217.86
7.4.130.0070.01016.65
7.4.120.0050.01316.61
7.4.110.0120.00316.62
7.4.100.0070.01816.66
7.4.90.0150.00916.68
7.4.80.0140.00816.47
7.4.70.0030.01416.63
7.4.60.0090.00916.41
7.4.50.0100.00616.52
7.4.40.0120.00415.91
7.4.30.0080.00816.25
7.4.20.0090.01116.19
7.4.10.0100.00916.47
7.4.00.0060.01115.82
7.3.330.0000.00613.30
7.3.320.0030.00313.54
7.3.310.0050.00216.29
7.3.300.0030.00316.43
7.3.290.0090.01216.46
7.3.280.0090.00916.46
7.3.270.0070.01317.40
7.3.260.0100.01416.64
7.3.250.0130.00416.37
7.3.240.0130.00316.62
7.3.230.0150.00616.45
7.3.210.0120.00616.67
7.3.200.0100.01319.39
7.3.190.0060.01516.55
7.3.180.0080.00816.37
7.3.170.0080.00816.20
7.3.160.0110.00616.39
7.3.150.0070.01016.44
7.3.140.0080.00816.38
7.3.130.0080.00916.30
7.3.120.0090.01215.63
7.3.110.0060.01015.36
7.3.100.0140.00315.81
7.3.90.0070.00615.58
7.3.80.0040.01115.64
7.3.70.0070.00915.57
7.3.60.0100.00915.71
7.3.50.0050.01115.66
7.3.40.0070.00915.47
7.3.30.0090.00615.47
7.3.20.0090.00816.53
7.3.10.0020.01416.41
7.3.00.0060.00716.50
7.2.330.0060.01216.82
7.2.320.0030.01516.64
7.2.310.0100.00716.69
7.2.300.0140.00316.34
7.2.290.0070.01316.59
7.2.280.0070.01016.38
7.2.270.0120.00916.46
7.2.260.0100.01316.38
7.2.250.0000.01615.61
7.2.240.0050.01315.85
7.2.230.0110.01015.98
7.2.220.0080.00615.84
7.2.210.0070.01015.64
7.2.200.0090.00915.92
7.2.190.0060.01015.75
7.2.180.0090.00715.63
7.2.170.0070.00915.75
7.2.160.0060.01216.49
7.2.150.0150.00316.57
7.2.140.0090.00916.43
7.2.130.0120.00616.57
7.2.120.0190.00016.42
7.2.110.0120.00616.43
7.2.100.0060.01216.47
7.2.90.0140.01016.49
7.2.80.0100.01016.55
7.2.70.0220.00016.53
7.2.60.0080.00916.76
7.2.50.0030.02016.59
7.2.40.0090.00916.58
7.2.30.0110.01416.74
7.2.20.0120.00616.50
7.2.10.0120.01216.37
7.2.00.0070.01216.54
7.1.330.0100.00915.54
7.1.320.0020.01315.62
7.1.310.0090.00615.60
7.1.300.0080.00715.63
7.1.290.0070.00715.67
7.1.280.0070.00815.77
7.1.270.0070.01215.70
7.1.260.0100.00615.63
7.1.250.0060.01115.39
7.1.240.0090.00915.46
7.1.230.0060.01015.31
7.1.220.0040.01615.35
7.1.210.0120.00615.47
7.1.200.0100.00515.44
7.1.190.0090.00915.31
7.1.180.0080.00815.33
7.1.170.0030.01315.43
7.1.160.0060.00915.39
7.1.150.0140.00315.31
7.1.140.0110.00715.45
7.1.130.0040.01615.48
7.1.120.0000.01915.35
7.1.110.0000.01815.46
7.1.100.0110.00316.82
7.1.90.0090.00915.31
7.1.80.0100.00715.41
7.1.70.0020.01316.19
7.1.60.0110.00717.54
7.1.50.0130.01316.27
7.1.40.0030.01315.43
7.1.30.0040.01315.47
7.1.20.0000.02115.51
7.1.10.0170.00415.39
7.1.00.0120.04318.97
7.0.330.0140.00314.79
7.0.320.0110.00614.94
7.0.310.0160.00314.98
7.0.300.0190.00314.88
7.0.290.0060.00915.11
7.0.280.0100.00614.99
7.0.270.0120.00615.16
7.0.260.0110.00615.08
7.0.250.0180.00414.86
7.0.240.0030.01315.12
7.0.230.0130.00514.95
7.0.220.0080.00814.96
7.0.210.0110.00614.81
7.0.200.0030.01015.77
7.0.190.0100.00514.94
7.0.180.0110.00715.00
7.0.170.0040.01315.00
7.0.160.0190.00015.07
7.0.150.0080.01115.01
7.0.140.0080.03618.51
7.0.130.0080.00814.87
7.0.120.0100.00815.11
7.0.110.0050.01714.85
7.0.100.0100.00714.90
7.0.90.0080.00815.12
7.0.80.0040.01215.12
7.0.70.0200.00414.98
7.0.60.0070.04317.54
7.0.50.0050.04116.47
7.0.40.0140.04517.45
7.0.30.0200.04317.71
7.0.20.0200.04417.59
7.0.10.0090.04317.71
7.0.00.0020.05617.52
5.6.400.0060.01215.68
5.6.390.0030.01615.89
5.6.380.0040.01815.71
5.6.370.0090.00915.93
5.6.360.0090.01515.80
5.6.350.0100.01015.84
5.6.340.0130.00515.60
5.6.330.0060.01615.69
5.6.320.0110.00815.73
5.6.310.0080.01215.87
5.6.300.0150.00315.52
5.6.290.0040.01715.97
5.6.280.0060.04018.35
5.6.270.0120.00615.61
5.6.260.0040.01615.88
5.6.250.0110.00715.63
5.6.240.0070.01115.95
5.6.230.0060.01215.84
5.6.220.0030.01715.53
5.6.210.0090.02218.23
5.6.200.0110.04516.93
5.6.190.0080.02718.13
5.6.180.0310.02518.10
5.6.170.0130.03018.09
5.6.160.0130.04418.20
5.6.150.0020.03816.95
5.6.140.0100.02817.11
5.6.130.0050.03216.99
5.6.120.0170.03818.40
5.6.110.0100.03218.35
5.6.100.0110.02018.37
5.6.90.0070.04618.51
5.6.80.0050.02518.08
5.6.70.0120.01015.78
5.6.60.0090.00915.75
5.6.50.0040.01515.74
5.6.40.0000.01915.54
5.6.30.0090.01515.56
5.6.20.0190.00315.43
5.6.10.0110.00815.41
5.6.00.0060.01515.68
5.5.380.0040.01315.67
5.5.370.0140.00615.71
5.5.360.0160.00315.82
5.5.350.0080.04318.00
5.5.340.0110.04216.77
5.5.330.0050.02818.05
5.5.320.0650.02518.06
5.5.310.0180.04518.06
5.5.300.0060.02416.88
5.5.290.0070.04716.82
5.5.280.0100.04818.20
5.5.270.0080.02518.29
5.5.260.0120.03318.21
5.5.250.0070.03518.14
5.5.240.0080.03818.00
5.5.230.0090.00915.77
5.5.220.0080.01115.58
5.5.210.0120.00615.80
5.5.200.0110.00715.71
5.5.190.0080.01515.51
5.5.180.0070.01215.80
5.5.170.0130.00615.45
5.5.160.0140.00515.83
5.5.150.0040.01515.65
5.5.140.0080.01215.52
5.5.130.0150.00415.99
5.5.120.0110.00715.68
5.5.110.0120.00615.73
5.5.100.0100.01015.46
5.5.90.0040.01515.64
5.5.80.0140.00615.50
5.5.70.0150.00415.45
5.5.60.0120.00815.64
5.5.50.0040.01615.72
5.5.40.0060.01315.59
5.5.30.0120.00815.40
5.5.20.0150.00415.73
5.5.10.0070.01115.53
5.5.00.0040.01515.70
5.4.450.0280.02816.04
5.4.440.0310.03115.96
5.4.430.0220.02016.06
5.4.420.0230.02516.07
5.4.410.0450.02215.83
5.4.400.0210.02115.63
5.4.390.0510.02615.92
5.4.380.0260.02615.91
5.4.370.0260.02215.81
5.4.360.0180.02315.90
5.4.350.0180.02215.68
5.4.340.0140.02715.85
5.4.330.0080.00512.61
5.4.320.0230.02315.75
5.4.310.0360.02315.93
5.4.300.0240.02615.87
5.4.290.0350.02515.73
5.4.280.0250.02215.85
5.4.270.0430.02215.76
5.4.260.0270.01715.65
5.4.250.0100.02015.76
5.4.240.0100.02615.85
5.4.230.0140.02415.79
5.4.220.0140.02215.84
5.4.210.0170.02315.99
5.4.200.0080.02315.82
5.4.190.0080.02715.65
5.4.180.0120.02215.76
5.4.170.0130.02015.84
5.4.160.0280.02815.75
5.4.150.0220.02315.85
5.4.140.0320.02614.50
5.4.130.0230.02014.50
5.4.120.0310.02014.58
5.4.110.0260.02114.40
5.4.100.0300.02514.52
5.4.90.0250.02614.47
5.4.80.0120.02914.55
5.4.70.0350.02414.42
5.4.60.0140.02114.44
5.4.50.0230.02314.30
5.4.40.0400.02314.61
5.4.30.0380.01714.42
5.4.20.0340.01914.44
5.4.10.0200.02214.50
5.4.00.0100.02014.22
5.3.290.0190.02814.26
5.3.280.0160.02014.04
5.3.270.0100.02514.14
5.3.260.0050.02714.13
5.3.250.0220.02514.15
5.3.240.0260.02514.05
5.3.230.0150.02714.07
5.3.220.0180.02914.01
5.3.210.0230.03214.08
5.3.200.0280.02514.04
5.3.190.0280.02214.02
5.3.180.0340.02514.16
5.3.170.0180.03214.18
5.3.160.0280.02414.11
5.3.150.0130.03214.10
5.3.140.0270.02214.08
5.3.130.0240.02514.08
5.3.120.0120.02814.14
5.3.110.0220.02314.15
5.3.100.0100.02513.60
5.3.90.0100.02313.71
5.3.80.0110.02613.62
5.3.70.0070.02713.58
5.3.60.0060.04213.60
5.3.50.0080.03513.58
5.3.40.0260.01813.51
5.3.30.0520.01913.46
5.3.20.0420.01613.35
5.3.10.0160.02613.38
5.3.00.0320.01813.26
5.2.170.0030.02313.02
5.2.160.0150.02113.02
5.2.150.0190.02112.96
5.2.140.0400.01512.20
5.2.130.0050.01512.22
5.2.120.0060.02112.26
5.2.110.0360.01312.27
5.2.100.0140.01912.25
5.2.90.0300.01912.16
5.2.80.0220.02012.12
5.2.70.0180.02012.22
5.2.60.0170.01912.13
5.2.50.0250.01812.18
5.2.40.0150.01812.18
5.2.30.0300.01612.15
5.2.20.0030.01812.15
5.2.10.0150.02012.04
5.2.00.0080.02012.07
5.1.60.0050.01911.67
5.1.50.0220.01511.80
5.1.40.0180.01211.80
5.1.30.0230.01911.83
5.1.20.0220.01711.74
5.1.10.0170.01911.74
5.1.00.0140.01211.74
5.0.50.0070.01611.25
5.0.40.0080.01111.25
5.0.30.0150.01611.25
5.0.20.0080.01511.28
5.0.10.0070.01411.25
5.0.00.0150.02011.25
4.4.90.0050.01011.26
4.4.80.0130.00711.26
4.4.70.0040.01011.25
4.4.60.0070.01111.25
4.4.50.0110.00611.25
4.4.40.0080.01611.25
4.4.30.0100.01311.25
4.4.20.0090.00811.25
4.4.10.0080.00811.25
4.4.00.0170.01111.25
4.3.110.0070.01111.25
4.3.100.0090.00711.25
4.3.90.0130.01011.25
4.3.80.0040.01511.25
4.3.70.0080.01311.25
4.3.60.0150.00711.25
4.3.50.0050.01111.25
4.3.40.0060.01311.25
4.3.30.0040.00811.25
4.3.20.0020.01111.25
4.3.10.0050.00711.25
4.3.00.0060.01211.25

preferences:
38.34 ms | 401 KiB | 5 Q