3v4l.org

run code in 300+ PHP versions simultaneously
<?php say("strcmp(): Returns < 0 if str1 is less than str2;\n", " > 0 if str1 is greater than str2, and 0 if they are equal.\n", " http://php.net/manual/en/function.strcmp.php"); # basic test string_lt('a', 'z'); # numeric strings string_lt('22', '123'); # non-numeric strings string_lt('bb', 'abc'); # non-numeric strings with numbers in # should be the same as "numeric strings" if strcmp() really does string comparison string_lt('22x', '123x'); function string_lt($str1, $str2) { # < operator if ($str1 < $str2) { say("$str1 < $str2"); } if ($str2 < $str1) { say("$str2 < $str1"); } # good old strcmp() if (strcmp($str1, $str2)) { say("$str1 < $str2"); } if ($str2 < $str1) { say("$str2 < $str1"); } } function string_lt_old($str1, $str2) { # you can't use < operator for comparing strings # wacky stuff will happen $lt_says = ((string) $str1 < (string) $str2); # see what strcmp() says $strcmp_says = strcmp($str1, $str2); echo "$str1 less than $str2; lt_says: $lt_says, strcmp_says: $strcmp_says\n"; } function say(...$msgs) { foreach ($msgs as $msg) { echo $msg; } echo "\n"; }

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.0120.00818.18
8.3.50.0120.00722.95
8.3.40.0040.01118.67
8.3.30.0070.00719.06
8.3.20.0030.00620.30
8.3.10.0040.00423.61
8.3.00.0030.00519.25
8.2.180.0100.01016.50
8.2.170.0070.00722.96
8.2.160.0060.00920.30
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0050.00320.94
8.2.110.0000.00922.08
8.2.100.0090.00318.20
8.2.90.0000.00919.22
8.2.80.0040.00417.97
8.2.70.0070.00417.50
8.2.60.0080.00017.93
8.2.50.0000.00818.07
8.2.40.0000.00818.09
8.2.30.0090.00017.95
8.2.20.0060.00317.63
8.2.10.0020.00518.01
8.2.00.0000.00717.71
8.1.280.0110.00725.92
8.1.270.0000.00923.71
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00822.19
8.1.230.0060.00619.01
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0060.00317.22
8.1.190.0000.00917.10
8.1.180.0030.00518.10
8.1.170.0090.00018.67
8.1.160.0040.00421.98
8.1.150.0000.00818.94
8.1.140.0040.00417.35
8.1.130.0070.00017.70
8.1.120.0070.00017.31
8.1.110.0000.00717.40
8.1.100.0040.00417.32
8.1.90.0000.00817.38
8.1.80.0000.00717.34
8.1.70.0000.00717.29
8.1.60.0060.00317.54
8.1.50.0030.00517.45
8.1.40.0040.00417.48
8.1.30.0030.00617.60
8.1.20.0040.00417.54
8.1.10.0040.00417.53
8.1.00.0000.00817.46
8.0.300.0000.00818.77
8.0.290.0000.00716.63
8.0.280.0000.00718.46
8.0.270.0030.00317.28
8.0.260.0030.00317.39
8.0.250.0070.00016.99
8.0.240.0040.00417.04
8.0.230.0070.00016.89
8.0.220.0040.00416.96
8.0.210.0000.00716.95
8.0.200.0030.00316.95
8.0.190.0030.00517.04
8.0.180.0040.00416.91
8.0.170.0000.00816.83
8.0.160.0000.00716.79
8.0.150.0040.00416.85
8.0.140.0000.00716.76
8.0.130.0000.00513.41
8.0.120.0040.00416.84
8.0.110.0000.00716.93
8.0.100.0040.00416.83
8.0.90.0030.00616.82
8.0.80.0150.00616.86
8.0.70.0000.00716.91
8.0.60.0000.00816.78
8.0.50.0040.00416.77
8.0.30.0110.00816.97
8.0.20.0090.00917.40
8.0.10.0040.00417.00
8.0.00.0060.01416.90
7.4.330.0050.00015.10
7.4.320.0060.00016.52
7.4.300.0000.00616.42
7.4.290.0030.00316.45
7.4.280.0040.00416.62
7.4.270.0030.00316.64
7.4.260.0070.00016.48
7.4.250.0040.00416.39
7.4.240.0050.00316.57
7.4.230.0000.00716.65
7.4.220.0030.01416.56
7.4.210.0140.00716.45
7.4.200.0000.00716.52
7.4.160.0130.00316.61
7.4.150.0090.00917.40
7.4.140.0030.01317.86
7.4.130.0080.00916.52
7.4.120.0050.01316.64
7.4.110.0070.01116.46
7.4.100.0090.00916.56
7.4.90.0140.00416.60
7.4.80.0100.00719.39
7.4.70.0180.00616.43
7.4.60.0060.01116.44
7.4.50.0070.00516.45
7.4.40.0160.00015.87
7.4.30.0130.00315.97
7.4.20.0090.00616.28
7.4.10.0120.00416.22
7.4.00.0110.00615.89
7.3.330.0000.00613.21
7.3.320.0000.00513.24
7.3.310.0000.00716.29
7.3.300.0030.00316.44
7.3.290.0120.00316.41
7.3.280.0100.00516.44
7.3.270.0030.02017.40
7.3.260.0080.00816.24
7.3.250.0150.00416.67
7.3.240.0100.00716.73
7.3.230.0140.00316.67
7.3.210.0120.01216.56
7.3.200.0090.01219.39
7.3.190.0070.01016.52
7.3.180.0070.01016.55
7.3.170.0030.01216.34
7.3.160.0090.00616.36
7.3.150.0080.00816.04
7.3.140.0120.00416.43
7.3.130.0080.00816.37
7.3.120.0100.00716.27
7.3.110.0070.01416.25
7.3.100.0040.01316.25
7.3.90.0040.01516.31
7.3.80.0040.01116.51
7.3.70.0060.00916.32
7.3.60.0120.00416.48
7.3.50.0080.00816.27
7.3.40.0090.00616.39
7.3.30.0060.01016.16
7.3.20.0060.01116.21
7.3.10.0060.01016.08
7.3.00.0130.01016.28
7.2.330.0120.01216.75
7.2.320.0080.01216.61
7.2.310.0130.00316.52
7.2.300.0030.01316.49
7.2.290.0100.00616.52
7.2.280.0030.01916.48
7.2.270.0060.01016.32
7.2.260.0080.00916.49
7.2.250.0070.01016.48
7.2.240.0180.00316.23
7.2.230.0120.00416.38
7.2.220.0160.00016.21
7.2.210.0100.00716.34
7.2.200.0090.01216.42
7.2.190.0120.00616.39
7.2.180.0080.00816.60
7.2.170.0040.01216.33
7.2.160.0100.00716.47
7.2.150.0060.01116.57
7.2.140.0130.00316.48
7.2.130.0110.00616.77
7.2.120.0000.01816.40
7.2.110.0100.00716.44
7.2.100.0100.00616.45
7.2.90.0100.01316.45
7.2.80.0100.01316.42
7.2.70.0110.00716.61
7.2.60.0090.00916.63
7.2.50.0110.00716.57
7.2.40.0100.00716.37
7.2.30.0090.01416.50
7.2.20.0070.01116.61
7.2.10.0140.00316.51
7.2.00.0090.00916.60
7.1.330.0080.00815.64
7.1.320.0100.00615.63
7.1.310.0090.00615.51
7.1.300.0130.00315.45
7.1.290.0070.00815.46
7.1.280.0120.00315.64
7.1.270.0110.00415.44
7.1.260.0100.00615.43
7.1.250.0120.00415.43
7.1.240.0090.00615.57
7.1.230.0120.00315.41
7.1.220.0070.00715.48
7.1.210.0080.00815.39
7.1.200.0100.00715.45
7.1.190.0060.01015.61
7.1.180.0110.00615.37
7.1.170.0080.00815.20
7.1.160.0120.00315.13
7.1.150.0080.00815.51
7.1.140.0060.01215.39
7.1.130.0090.01315.54
7.1.120.0060.00915.44
7.1.110.0090.01315.36
7.1.100.0120.00915.55
7.1.90.0110.00615.38
7.1.80.0090.00915.52
7.1.70.0030.00916.12
7.1.60.0060.01117.49
7.1.50.0090.00916.22
7.1.40.0090.00915.50
7.1.30.0080.01515.36
7.1.20.0160.00015.43
7.1.10.0110.00415.23
7.1.00.0060.04118.97
7.0.330.0060.00915.06
7.0.320.0090.00614.89
7.0.310.0060.00914.93
7.0.300.0200.00315.08
7.0.290.0140.00315.09
7.0.280.0080.01215.09
7.0.270.0040.01215.16
7.0.260.0090.01215.18
7.0.250.0040.01214.93
7.0.240.0090.00715.07
7.0.230.0040.01214.88
7.0.220.0140.01115.11
7.0.210.0060.01014.96
7.0.200.0030.00815.95
7.0.190.0120.00315.10
7.0.180.0100.00615.34
7.0.170.0070.00715.17
7.0.160.0050.01114.96
7.0.150.0090.00915.13
7.0.140.0080.03618.66
7.0.130.0000.01515.17
7.0.120.0050.01015.17
7.0.110.0090.00615.17
7.0.100.0090.00615.06
7.0.90.0140.00315.18
7.0.80.0090.00915.25
7.0.70.0120.00615.16
7.0.60.0040.02617.54
7.0.50.0040.02716.52
7.0.40.0120.04117.67
7.0.30.0180.03717.65
7.0.20.0220.01817.64
7.0.10.0100.04517.61
7.0.00.0080.05017.52
5.6.400.0100.01015.93
5.6.390.0090.00915.58
5.6.380.0090.01615.86
5.6.370.0060.01216.13
5.6.360.0090.00915.67
5.6.350.0000.01715.88
5.6.340.0180.00615.89
5.6.330.0070.01115.65
5.6.320.0070.01515.79
5.6.310.0090.00915.73
5.6.300.0100.01315.79
5.6.290.0090.00915.95
5.6.280.0060.01215.73
5.6.270.0110.00715.76
5.6.260.0110.01115.57
5.6.250.0090.00915.77
5.6.240.0130.00615.59
5.6.230.0090.01215.75
5.6.220.0000.02015.74
5.6.210.0120.04218.08
5.6.200.0100.02516.88
5.6.190.0080.04318.21
5.6.180.0220.04218.18
5.6.170.0220.03018.15
5.6.160.0130.04618.22
5.6.150.0110.04316.94
5.6.140.0030.02817.04
5.6.130.0070.03016.89
5.6.120.0070.03018.43
5.6.110.0060.04918.38
5.6.100.0090.02418.23
5.6.90.0110.02318.38
5.6.80.0080.04518.03
5.6.70.0100.00715.84
5.6.60.0070.01115.63
5.6.50.0030.01515.76
5.6.40.0100.01115.46
5.6.30.0100.01015.61
5.6.20.0080.01115.75
5.6.10.0040.01315.69
5.6.00.0060.01215.78
5.5.380.0030.01515.56
5.5.370.0120.00915.62
5.5.360.0100.01015.36
5.5.350.0210.04117.78
5.5.340.0080.02616.79
5.5.330.0060.04118.00
5.5.320.0150.04717.81
5.5.310.0170.05017.83
5.5.300.0100.03816.69
5.5.290.0020.02816.70
5.5.280.0100.03018.14
5.5.270.0080.04718.11
5.5.260.0110.04318.00
5.5.250.0110.04518.01
5.5.240.0070.04317.67
5.5.230.0060.01215.29
5.5.220.0090.00915.63
5.5.210.0150.00515.41
5.5.200.0060.01215.31
5.5.190.0090.01215.25
5.5.180.0100.01015.33
5.5.170.0030.01515.35
5.5.160.0120.00615.35
5.5.150.0120.00615.37
5.5.140.0090.01415.25
5.5.130.0140.00315.34
5.5.120.0090.00915.45
5.5.110.0110.00815.38
5.5.100.0100.00715.23
5.5.90.0030.01315.50
5.5.80.0180.00315.23
5.5.70.0090.00915.33
5.5.60.0070.01115.34
5.5.50.0060.01015.48
5.5.40.0110.00615.31
5.5.30.0030.01315.41
5.5.20.0060.01115.15
5.5.10.0030.01315.47
5.5.00.0120.00615.27
5.4.450.0100.02115.86
5.4.440.0110.01815.88
5.4.430.0100.02115.78
5.4.420.0120.02515.80
5.4.410.0120.02815.83
5.4.400.0130.02015.57
5.4.390.0070.02315.66
5.4.380.0170.03415.55
5.4.370.0200.03915.42
5.4.360.0260.03415.42
5.4.350.0190.03115.49
5.4.340.0190.04515.54
5.4.330.0100.00312.16
5.4.320.0080.02412.33
5.4.310.0070.02212.41
5.4.300.0080.02112.40
5.4.290.0070.02012.30
5.4.280.0060.02012.40
5.4.270.0050.02212.36
5.4.260.0070.02112.43
5.4.250.0060.02212.26
5.4.240.0060.02212.33
5.4.230.0090.01812.25
5.4.220.0050.02212.33
5.4.210.0040.02212.27
5.4.200.0020.02512.34
5.4.190.0060.02112.34
5.4.180.0060.02112.35
5.4.170.0070.02012.29
5.4.160.0080.01912.22
5.4.150.0060.02112.30
5.4.140.0050.02112.15
5.4.130.0050.02212.18
5.4.120.0080.01912.17
5.4.110.0060.02012.14
5.4.100.0040.02312.13
5.4.90.0040.02312.21
5.4.80.0080.01912.12
5.4.70.0070.01912.16
5.4.60.0070.02312.12
5.4.50.0090.01812.14
5.4.40.0050.02112.19
5.4.30.0040.02212.15
5.4.20.0030.02312.13
5.4.10.0070.01912.14
5.4.00.0070.02111.84
5.3.290.0070.02112.87
5.3.280.0060.02312.76
5.3.270.0020.02812.82
5.3.260.0070.02312.72
5.3.250.0040.02312.75
5.3.240.0030.02712.67
5.3.230.0050.02312.78
5.3.220.0080.02012.68
5.3.210.0070.02412.68
5.3.200.0060.02212.76
5.3.190.0080.02012.76
5.3.180.0040.02412.78
5.3.170.0050.02312.78
5.3.160.0050.02212.83
5.3.150.0090.01912.83
5.3.140.0040.02312.82
5.3.130.0070.02112.79
5.3.120.0080.02512.75
5.3.110.0050.02412.79
5.3.100.0070.02712.54
5.3.90.0020.02612.49
5.3.80.0040.02812.43
5.3.70.0060.02512.42
5.3.60.0020.02512.44
5.3.50.0060.02512.51
5.3.40.0060.02812.40
5.3.30.0070.02312.35
5.3.20.0070.02512.28
5.3.10.0040.02612.21
5.3.00.0060.02312.12
5.2.170.0060.01710.53
5.2.160.0050.01910.61
5.2.150.0080.01710.52
5.2.140.0050.01910.55
5.2.130.0030.02110.61
5.2.120.0050.01910.60
5.2.110.0050.01810.54
5.2.100.0060.01910.49
5.2.90.0020.02310.55
5.2.80.0050.02110.50
5.2.70.0070.01710.43
5.2.60.0030.02210.41
5.2.50.0040.01910.51
5.2.40.0030.02010.41
5.2.30.0060.01910.44
5.2.20.0040.01810.35
5.2.10.0070.01510.29
5.2.00.0040.01810.11
5.1.60.0060.0149.53
5.1.50.0050.0179.45
5.1.40.0040.0199.49
5.1.30.0040.0199.72
5.1.20.0040.0189.73
5.1.10.0040.0189.49
5.1.00.0040.0169.42
5.0.50.0030.0148.51
5.0.40.0060.0118.37
5.0.30.0040.0178.23
5.0.20.0030.0158.22
5.0.10.0030.0128.21
5.0.00.0040.0168.21
4.4.90.0020.0117.46
4.4.80.0020.0117.45
4.4.70.0010.0107.45
4.4.60.0030.0117.45
4.4.50.0020.0107.46
4.4.40.0040.0127.42
4.4.30.0010.0107.45
4.4.20.0020.0097.49
4.4.10.0040.0097.50
4.4.00.0020.0147.45
4.3.110.0020.0107.40
4.3.100.0020.0107.40
4.3.90.0050.0077.39
4.3.80.0030.0127.36
4.3.70.0020.0107.38
4.3.60.0030.0087.38
4.3.50.0010.0107.38
4.3.40.0040.0167.34
4.3.30.0010.0136.73
4.3.20.0040.0076.72
4.3.10.0020.0106.70
4.3.00.0040.01014.28

preferences:
40.62 ms | 401 KiB | 5 Q