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'); # numbers? who knows? string_lt(22, 123); 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) < 0) { say("strcmp says: $str1 < $str2"); } if (strcmp($str2, $str1) < 0) { say("strcmp says: $str2 < $str1"); } } 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.70.0060.01516.58
8.3.60.0090.00618.43
8.3.50.0120.00322.95
8.3.40.0150.00018.79
8.3.30.0040.01119.01
8.3.20.0000.00720.34
8.3.10.0040.00423.64
8.3.00.0080.00019.25
8.2.180.0180.00416.73
8.2.170.0040.01122.96
8.2.160.0070.00720.53
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0040.00426.16
8.2.120.0000.00821.08
8.2.110.0030.00621.07
8.2.100.0030.00917.78
8.2.90.0050.00319.05
8.2.80.0000.00817.97
8.2.70.0060.00317.37
8.2.60.0050.00317.80
8.2.50.0000.00818.07
8.2.40.0050.00318.09
8.2.30.0000.00718.05
8.2.20.0000.00817.57
8.2.10.0000.00717.95
8.2.00.0050.00217.56
8.1.280.0140.00725.92
8.1.270.0040.00423.84
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0080.00022.14
8.1.230.0060.00619.00
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0060.00317.23
8.1.190.0080.00017.00
8.1.180.0030.00618.10
8.1.170.0080.00018.39
8.1.160.0040.00422.10
8.1.150.0070.00018.86
8.1.140.0040.00417.42
8.1.130.0070.00017.67
8.1.120.0030.00517.41
8.1.110.0040.00417.29
8.1.100.0070.00017.45
8.1.90.0000.00717.35
8.1.80.0040.00417.38
8.1.70.0070.00017.40
8.1.60.0050.00317.47
8.1.50.0080.00017.38
8.1.40.0000.00717.39
8.1.30.0000.00817.63
8.1.20.0000.00717.65
8.1.10.0040.00417.49
8.1.00.0040.00417.36
8.0.300.0050.00218.77
8.0.290.0000.00816.88
8.0.280.0000.00718.36
8.0.270.0000.00717.29
8.0.260.0060.00017.19
8.0.250.0030.00316.99
8.0.240.0050.00317.01
8.0.230.0000.00816.98
8.0.220.0030.00316.82
8.0.210.0080.00016.95
8.0.200.0030.00317.00
8.0.190.0030.00317.04
8.0.180.0000.00816.93
8.0.170.0030.00516.96
8.0.160.0000.00716.93
8.0.150.0050.00316.85
8.0.140.0000.00716.80
8.0.130.0030.00313.42
8.0.120.0060.00316.79
8.0.110.0070.00016.90
8.0.100.0040.00416.70
8.0.90.0000.00816.88
8.0.80.0060.01316.84
8.0.70.0040.00417.05
8.0.60.0070.00016.83
8.0.50.0000.00816.72
8.0.30.0050.01916.99
8.0.20.0060.01317.40
8.0.10.0000.00816.93
8.0.00.0050.01416.73
7.4.330.0000.00515.05
7.4.320.0000.00716.61
7.4.300.0030.00316.64
7.4.290.0000.00716.62
7.4.280.0040.00416.48
7.4.270.0000.00616.47
7.4.260.0060.00316.54
7.4.250.0050.00316.60
7.4.240.0070.00216.57
7.4.230.0070.00016.45
7.4.220.0060.01216.59
7.4.210.0100.00316.63
7.4.200.0000.00716.53
7.4.160.0130.01016.36
7.4.150.0140.01017.40
7.4.140.0100.00817.86
7.4.130.0070.01016.65
7.4.120.0120.00516.46
7.4.110.0110.00616.58
7.4.100.0060.01216.63
7.4.90.0030.01416.47
7.4.80.0100.00719.39
7.4.70.0110.00816.62
7.4.60.0110.00716.38
7.4.50.0040.01316.35
7.4.40.0060.00916.21
7.4.30.0150.00615.98
7.4.20.0120.00616.31
7.4.10.0100.00815.82
7.4.00.0050.01315.48
7.3.330.0020.00213.41
7.3.320.0000.00513.27
7.3.310.0030.00316.23
7.3.300.0000.00716.45
7.3.290.0060.01416.42
7.3.280.0100.00716.39
7.3.270.0070.01017.40
7.3.260.0030.01416.57
7.3.250.0100.00916.61
7.3.240.0100.00716.71
7.3.230.0090.00916.55
7.3.210.0070.01116.46
7.3.200.0080.01419.39
7.3.190.0100.00716.54
7.3.180.0060.01016.51
7.3.170.0000.01616.54
7.3.160.0000.01516.21
7.3.150.0090.00616.27
7.3.140.0080.00816.19
7.3.130.0100.01015.69
7.3.120.0050.01015.35
7.3.110.0080.01015.34
7.3.100.0110.00615.19
7.3.90.0040.01015.38
7.3.80.0060.01015.31
7.3.70.0060.00815.37
7.3.60.0050.00815.33
7.3.50.0010.01315.40
7.3.40.0030.01215.29
7.3.30.0090.00615.26
7.3.20.0080.00616.42
7.3.10.0100.00516.50
7.3.00.0160.01216.59
7.2.330.0190.00516.75
7.2.320.0110.00816.82
7.2.310.0100.00616.63
7.2.300.0170.00316.50
7.2.290.0100.01316.34
7.2.280.0090.00916.54
7.2.270.0070.01016.54
7.2.260.0090.01215.66
7.2.250.0060.01215.50
7.2.240.0120.00515.37
7.2.230.0070.00815.49
7.2.220.0060.00915.44
7.2.210.0040.01115.56
7.2.200.0050.00715.56
7.2.190.0050.00915.42
7.2.180.0080.00615.47
7.2.170.0010.01415.53
7.2.160.0080.00615.51
7.2.150.0080.00816.85
7.2.140.0070.00916.79
7.2.130.0070.00816.75
7.2.120.0060.01116.86
7.2.110.0090.00816.85
7.2.100.0030.01216.77
7.2.90.0060.00916.74
7.2.80.0120.00316.79
7.2.70.0070.01016.76
7.2.60.0040.01116.72
7.2.50.0080.00516.69
7.2.40.0060.00916.83
7.2.30.0090.00716.79
7.2.20.0060.00816.82
7.2.10.0130.00516.82
7.2.00.0040.01116.79
7.1.330.0080.00815.71
7.1.320.0080.00615.77
7.1.310.0010.01315.71
7.1.300.0070.00515.64
7.1.290.0060.00815.46
7.1.280.0080.00515.55
7.1.270.0070.00915.62
7.1.260.0050.00915.76
7.1.250.0050.00815.62
7.1.240.0070.00815.84
7.1.230.0060.00815.67
7.1.220.0050.00715.75
7.1.210.0070.00515.63
7.1.200.0130.00515.67
7.1.190.0060.00715.66
7.1.180.0070.00615.56
7.1.170.0040.00715.59
7.1.160.0120.00215.61
7.1.150.0070.00715.66
7.1.140.0060.00715.70
7.1.130.0090.00615.68
7.1.120.0070.00815.64
7.1.110.0060.00915.66
7.1.100.0070.00815.64
7.1.90.0060.00915.62
7.1.80.0070.00815.72
7.1.70.0060.00715.92
7.1.60.0040.01016.67
7.1.50.0080.00916.05
7.1.40.0070.00715.58
7.1.30.0040.00915.70
7.1.20.0080.00615.81
7.1.10.0100.00415.61
7.1.00.0090.02217.30
7.0.330.0100.00615.40
7.0.320.0080.00615.32
7.0.310.0070.00715.36
7.0.300.0050.00915.25
7.0.290.0070.00615.28
7.0.280.0050.00915.37
7.0.270.0090.00415.30
7.0.260.0040.01015.34
7.0.250.0070.00615.33
7.0.240.0080.00615.31
7.0.230.0090.00615.35
7.0.220.0090.00815.28
7.0.210.0060.00715.31
7.0.200.0060.00715.74
7.0.190.0080.00515.29
7.0.180.0070.00615.29
7.0.170.0020.01215.30
7.0.160.0060.00615.31
7.0.150.0050.00915.33
7.0.140.0030.02617.01
7.0.130.0050.00615.43
7.0.120.0070.00715.26
7.0.110.0040.01115.22
7.0.100.0070.01015.21
7.0.90.0060.00915.32
7.0.80.0090.00715.30
7.0.70.0080.00515.22
7.0.60.0080.01316.56
7.0.50.0060.01715.92
7.0.40.0020.01915.55
7.0.30.0130.02015.58
7.0.20.0090.02215.46
7.0.10.0050.02115.52
7.0.00.0060.02615.52
5.6.400.0070.00714.90
5.6.390.0060.00914.78
5.6.380.0060.00914.85
5.6.370.0060.00814.96
5.6.360.0070.00614.84
5.6.350.0000.01414.79
5.6.340.0030.01014.73
5.6.330.0080.00914.80
5.6.320.0040.01314.90
5.6.310.0060.00614.85
5.6.300.0050.01014.71
5.6.290.0080.00714.78
5.6.280.0050.02516.27
5.6.270.0060.01014.73
5.6.260.0130.00314.69
5.6.250.0070.00614.87
5.6.240.0050.00914.79
5.6.230.0050.00814.70
5.6.220.0070.00714.72
5.6.210.0060.02516.18
5.6.200.0060.02515.56
5.6.190.0050.02816.17
5.6.180.0130.02316.14
5.6.170.0110.02516.29
5.6.160.0070.01816.28
5.6.150.0090.01515.50
5.6.140.0100.01615.68
5.6.130.0060.01915.54
5.6.120.0100.01916.49
5.6.110.0070.02216.30
5.6.100.0100.01416.24
5.6.90.0070.02716.34
5.6.80.0100.02016.01
5.6.70.0050.01214.81
5.6.60.0090.00714.80
5.6.50.0110.00614.87
5.6.40.0070.00814.69
5.6.30.0090.00714.63
5.6.20.0040.00814.60
5.6.10.0070.00714.72
5.6.00.0090.00814.74
5.5.380.0060.01014.61
5.5.370.0080.00614.58
5.5.360.0090.00514.73
5.5.350.0150.02015.91
5.5.340.0080.02215.45
5.5.330.0070.02115.93
5.5.320.0110.01515.87
5.5.310.0090.02515.80
5.5.300.0070.01615.43
5.5.290.0080.01815.38
5.5.280.0030.02716.20
5.5.270.0040.02815.97
5.5.260.0070.02316.14
5.5.250.0050.02415.93
5.5.240.0070.02215.92
5.5.230.0060.00914.50
5.5.220.0030.01114.44
5.5.210.0060.00814.50
5.5.200.0060.00814.47
5.5.190.0070.00814.52
5.5.180.0030.01114.40
5.5.170.0080.00714.44
5.5.160.0070.00814.50
5.5.150.0070.00714.42
5.5.140.0060.00714.27
5.5.130.0030.01314.37
5.5.120.0090.00714.39
5.5.110.0070.00614.39
5.5.100.0050.00814.63
5.5.90.0050.01114.49
5.5.80.0040.01114.34
5.5.70.0100.00614.33
5.5.60.0080.00714.37
5.5.50.0010.01414.31
5.5.40.0090.00714.41
5.5.30.0070.00814.33
5.5.20.0060.00814.31
5.5.10.0070.00814.57
5.5.00.0060.01214.22
5.4.450.0080.01413.52
5.4.440.0090.01313.52
5.4.430.0070.01313.54
5.4.420.0070.01613.46
5.4.410.0070.01513.44
5.4.400.0070.01413.48
5.4.390.0080.01113.36
5.4.380.0100.01813.38
5.4.370.0140.01813.32
5.4.360.0110.01813.25
5.4.350.0100.01913.31
5.4.340.0140.01713.30
5.4.330.0050.00611.48
5.4.320.0050.01511.83
5.4.310.0030.01511.67
5.4.300.0050.01411.82
5.4.290.0030.01711.85
5.4.280.0070.01211.82
5.4.270.0030.01611.75
5.4.260.0040.01411.79
5.4.250.0050.01511.75
5.4.240.0070.01211.77
5.4.230.0040.01411.74
5.4.220.0050.01411.88
5.4.210.0060.01411.71
5.4.200.0080.01311.72
5.4.190.0030.01711.70
5.4.180.0050.01311.75
5.4.170.0070.01211.65
5.4.160.0050.01411.80
5.4.150.0030.01711.76
5.4.140.0060.01511.67
5.4.130.0050.01511.69
5.4.120.0050.01211.70
5.4.110.0060.01411.70
5.4.100.0040.01311.72
5.4.90.0040.01411.72
5.4.80.0070.01211.67
5.4.70.0060.01211.71
5.4.60.0050.01311.69
5.4.50.0040.01411.74
5.4.40.0040.01511.66
5.4.30.0050.01411.67
5.4.20.0060.01311.64
5.4.10.0070.01111.69
5.4.00.0040.01511.58
5.3.290.0090.02012.81
5.3.280.0060.02312.68
5.3.270.0070.02212.85
5.3.260.0080.02212.80
5.3.250.0090.01912.71
5.3.240.0060.02312.73
5.3.230.0070.02112.76
5.3.220.0070.02112.68
5.3.210.0110.01912.71
5.3.200.0060.02412.66
5.3.190.0070.02112.69
5.3.180.0070.02112.85
5.3.170.0020.02712.78
5.3.160.0090.02612.84
5.3.150.0080.02812.77
5.3.140.0040.02912.74
5.3.130.0050.02612.77
5.3.120.0120.01912.73
5.3.110.0070.02212.72
5.3.100.0070.02312.53
5.3.90.0060.02412.54
5.3.80.0050.02312.42
5.3.70.0060.02212.48
5.3.60.0060.02412.43
5.3.50.0030.02712.44
5.3.40.0060.02212.42
5.3.30.0100.02012.38
5.3.20.0020.02712.27
5.3.10.0080.02012.19
5.3.00.0060.02112.11
5.2.170.0060.01810.52
5.2.160.0040.01910.52
5.2.150.0050.01910.51
5.2.140.0050.02110.60
5.2.130.0080.01710.47
5.2.120.0030.01310.61
5.2.110.0100.01410.46
5.2.100.0060.01710.55
5.2.90.0080.01910.54
5.2.80.0070.01810.50
5.2.70.0050.02210.50
5.2.60.0070.01910.44
5.2.50.0060.02410.50
5.2.40.0080.01710.43
5.2.30.0110.01610.44
5.2.20.0050.01810.29
5.2.10.0080.01710.27
5.2.00.0060.01910.10
5.1.60.0040.0179.49
5.1.50.0070.0179.51
5.1.40.0070.0149.49
5.1.30.0090.0199.74
5.1.20.0050.0199.72
5.1.10.0080.0199.52
5.1.00.0080.0179.42
5.0.50.0050.0218.40
5.0.40.0090.0128.33
5.0.30.0060.0198.24
5.0.20.0070.0158.22
5.0.10.0060.0138.21
5.0.00.0030.0208.21
4.4.90.0010.0087.46
4.4.80.0050.0077.45
4.4.70.0050.0077.45
4.4.60.0040.0107.45
4.4.50.0020.0117.46
4.4.40.0040.0207.42
4.4.30.0040.0127.45
4.4.20.0030.0107.49
4.4.10.0030.0137.49
4.4.00.0040.0197.45
4.3.110.0040.0117.40
4.3.100.0030.0117.40
4.3.90.0030.0097.39
4.3.80.0040.0137.36
4.3.70.0060.0077.39
4.3.60.0040.0087.38
4.3.50.0040.0117.38
4.3.40.0020.0157.34
4.3.30.0040.0086.73
4.3.20.0020.0116.72
4.3.10.0010.0126.70
4.3.00.0070.00514.28

preferences:
56.45 ms | 401 KiB | 5 Q