3v4l.org

run code in 300+ PHP versions simultaneously
<?php say("strcmp(str1, str2): 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.60.0140.00318.15
8.3.50.0090.01222.83
8.3.40.0090.00618.54
8.3.30.0070.00718.97
8.3.20.0040.00420.30
8.3.10.0040.00423.83
8.3.00.0080.00019.38
8.2.180.0150.00716.38
8.2.170.0100.01022.96
8.2.160.0000.01420.39
8.2.150.0040.00424.18
8.2.140.0050.00224.66
8.2.130.0060.00326.16
8.2.120.0070.00419.26
8.2.110.0030.00620.86
8.2.100.0060.00617.59
8.2.90.0000.00819.14
8.2.80.0050.00317.97
8.2.70.0080.00017.38
8.2.60.0040.00418.04
8.2.50.0080.00018.07
8.2.40.0080.00018.16
8.2.30.0080.00017.91
8.2.20.0000.00817.54
8.2.10.0040.00418.08
8.2.00.0040.00417.55
8.1.280.0070.01425.92
8.1.270.0030.00523.92
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00622.20
8.1.230.0080.00318.82
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00817.36
8.1.190.0040.00417.11
8.1.180.0040.00418.10
8.1.170.0040.00418.66
8.1.160.0000.00722.01
8.1.150.0000.00818.76
8.1.140.0030.00617.38
8.1.130.0070.00017.74
8.1.120.0070.00017.33
8.1.110.0000.00717.43
8.1.100.0040.00417.35
8.1.90.0040.00417.33
8.1.80.0080.00017.43
8.1.70.0030.00317.38
8.1.60.0040.00417.54
8.1.50.0000.00817.39
8.1.40.0030.00617.52
8.1.30.0030.00517.61
8.1.20.0070.00017.52
8.1.10.0040.00417.55
8.1.00.0030.00617.36
8.0.300.0080.00018.77
8.0.290.0040.00416.88
8.0.280.0000.00718.47
8.0.270.0000.00717.29
8.0.260.0000.00617.30
8.0.250.0000.00716.89
8.0.240.0080.00016.99
8.0.230.0000.00716.89
8.0.220.0050.00316.81
8.0.210.0000.00716.83
8.0.200.0000.00616.94
8.0.190.0070.00016.99
8.0.180.0040.00416.95
8.0.170.0040.00416.84
8.0.160.0000.00716.96
8.0.150.0040.00416.84
8.0.140.0040.00416.80
8.0.130.0000.00513.40
8.0.120.0040.00416.91
8.0.110.0020.00516.75
8.0.100.0000.00716.88
8.0.90.0030.00616.80
8.0.80.0090.00916.98
8.0.70.0040.00416.92
8.0.60.0040.00416.97
8.0.50.0000.00816.72
8.0.30.0110.01117.09
8.0.20.0120.00817.40
8.0.10.0070.00017.16
8.0.00.0120.00816.67
7.4.330.0050.00015.15
7.4.320.0030.00316.65
7.4.300.0030.00316.53
7.4.290.0000.00716.64
7.4.280.0040.00416.65
7.4.270.0070.00016.68
7.4.260.0000.00816.51
7.4.250.0030.00516.59
7.4.240.0060.00116.64
7.4.230.0020.00516.66
7.4.220.0110.00616.68
7.4.210.0160.00316.60
7.4.200.0000.00716.71
7.4.160.0100.01016.49
7.4.150.0110.00717.40
7.4.140.0130.00517.86
7.4.130.0130.00616.60
7.4.120.0070.01016.63
7.4.110.0030.01416.55
7.4.100.0140.00316.52
7.4.90.0040.01516.58
7.4.80.0030.01619.39
7.4.70.0100.00916.63
7.4.60.0080.01016.45
7.4.50.0080.00616.56
7.4.40.0140.00616.33
7.4.30.0000.01816.38
7.4.20.0090.00916.20
7.4.10.0140.00716.19
7.4.00.0090.00916.04
7.3.330.0000.00513.40
7.3.320.0000.00513.40
7.3.310.0070.00016.40
7.3.300.0070.00016.30
7.3.290.0130.00616.30
7.3.280.0050.01016.37
7.3.270.0110.00717.40
7.3.260.0120.00616.59
7.3.250.0130.00816.40
7.3.240.0060.01216.64
7.3.230.0060.01216.61
7.3.210.0070.01816.63
7.3.200.0090.00819.39
7.3.190.0030.01416.67
7.3.180.0100.01216.45
7.3.170.0120.00716.25
7.3.160.0190.00016.43
7.3.150.0030.01616.82
7.3.140.0110.00716.49
7.3.130.0120.00616.51
7.3.120.0070.01316.64
7.3.110.0060.01216.24
7.3.100.0140.01116.35
7.3.90.0080.01316.61
7.3.80.0150.00316.42
7.3.70.0180.00416.39
7.3.60.0070.01016.51
7.3.50.0080.01316.49
7.3.40.0100.00716.48
7.3.30.0130.00416.24
7.3.20.0120.00916.46
7.3.10.0090.00916.49
7.3.00.0090.00916.50
7.2.330.0160.01016.79
7.2.320.0110.00616.76
7.2.310.0070.01116.39
7.2.300.0120.00616.70
7.2.290.0130.00616.54
7.2.280.0120.00616.86
7.2.270.0130.00616.80
7.2.260.0100.01316.79
7.2.250.0110.00716.38
7.2.240.0080.01216.49
7.2.230.0080.01616.69
7.2.220.0140.01216.67
7.2.210.0070.01016.82
7.2.200.0090.00916.64
7.2.190.0100.00916.59
7.2.180.0090.00916.48
7.2.170.0080.01516.67
7.2.160.0160.00616.73
7.2.150.0110.00816.73
7.2.140.0140.00816.55
7.2.130.0060.01016.84
7.2.120.0110.00616.85
7.2.110.0110.00516.79
7.2.100.0090.00616.69
7.2.90.0030.01216.83
7.2.80.0120.00416.84
7.2.70.0090.00716.65
7.2.60.0090.00716.85
7.2.50.0090.00916.76
7.2.40.0060.00916.80
7.2.30.0120.00616.82
7.2.20.0120.00416.81
7.2.10.0090.00616.92
7.2.00.0070.01017.68
7.1.330.0120.00815.39
7.1.320.0130.00615.54
7.1.310.0050.01115.52
7.1.300.0030.01515.41
7.1.290.0060.01215.33
7.1.280.0040.01415.70
7.1.270.0120.00615.43
7.1.260.0090.01215.34
7.1.250.0050.00815.53
7.1.240.0110.01115.21
7.1.230.0140.00915.40
7.1.220.0040.01215.39
7.1.210.0070.01015.24
7.1.200.0090.00615.46
7.1.190.0040.02115.47
7.1.180.0150.00315.34
7.1.170.0060.01215.16
7.1.160.0070.01115.12
7.1.150.0000.02015.48
7.1.140.0030.01415.45
7.1.130.0110.00515.45
7.1.120.0070.01015.30
7.1.110.0140.00315.57
7.1.100.0060.00916.74
7.1.90.0070.01015.25
7.1.80.0060.01215.41
7.1.70.0040.01116.31
7.1.60.0090.01317.44
7.1.50.0050.01816.27
7.1.40.0130.00615.46
7.1.30.0090.01215.45
7.1.20.0090.00915.56
7.1.10.0090.00915.28
7.1.00.0070.04818.85
7.0.330.0130.00315.01
7.0.320.0050.01114.90
7.0.310.0150.00215.02
7.0.300.0160.00615.09
7.0.290.0100.00715.13
7.0.280.0100.01015.17
7.0.270.0040.01115.11
7.0.260.0110.00515.13
7.0.250.0050.01115.02
7.0.240.0080.00815.25
7.0.230.0130.00315.10
7.0.220.0170.00815.24
7.0.210.0050.01315.08
7.0.200.0070.00715.90
7.0.190.0100.00515.07
7.0.180.0200.00015.05
7.0.170.0140.00415.22
7.0.160.0220.00015.03
7.0.150.0110.01115.36
7.0.140.0080.03918.61
7.0.130.0000.01515.06
7.0.120.0130.00715.20
7.0.110.0140.00515.31
7.0.100.0120.00814.96
7.0.90.0300.00615.23
7.0.80.0080.00815.11
7.0.70.0050.01115.18
7.0.60.0120.04317.42
7.0.50.0060.04716.54
7.0.40.0110.04517.75
7.0.30.0290.03017.66
7.0.20.0120.02517.54
7.0.10.0090.05117.57
7.0.00.0080.04417.55
5.6.400.0090.00915.52
5.6.390.0160.00415.75
5.6.380.0060.01415.64
5.6.370.0090.01515.72
5.6.360.0140.01215.95
5.6.350.0060.01415.85
5.6.340.0060.01315.75
5.6.330.0140.00415.90
5.6.320.0060.01215.95
5.6.310.0050.01415.83
5.6.300.0090.01515.95
5.6.290.0090.00915.73
5.6.280.0070.03818.38
5.6.270.0080.01115.86
5.6.260.0080.01215.64
5.6.250.0140.00915.54
5.6.240.0080.01315.70
5.6.230.0110.00715.76
5.6.220.0090.00915.68
5.6.210.0140.03918.03
5.6.200.0140.02216.95
5.6.190.0030.04918.11
5.6.180.0200.01918.13
5.6.170.0200.02018.04
5.6.160.0040.02818.11
5.6.150.0100.03616.84
5.6.140.0100.02317.03
5.6.130.0050.02716.70
5.6.120.0100.04818.45
5.6.110.0130.03818.37
5.6.100.0050.04718.26
5.6.90.0090.04918.38
5.6.80.0050.03418.08
5.6.70.0060.02118.03
5.6.60.0100.00715.71
5.6.50.0080.01115.78
5.6.40.0100.01015.57
5.6.30.0080.01215.52
5.6.20.0090.00915.66
5.6.10.0040.01515.95
5.6.00.0110.00715.79
5.5.380.0120.01215.45
5.5.370.0150.00815.41
5.5.360.0100.01115.30
5.5.350.0130.03817.77
5.5.340.0060.03016.68
5.5.330.0070.04017.84
5.5.320.0200.03917.96
5.5.310.0150.04517.94
5.5.300.0070.02716.66
5.5.290.0050.03316.64
5.5.280.0110.04018.22
5.5.270.0170.03818.16
5.5.260.0110.03718.14
5.5.250.0040.03917.85
5.5.240.0220.03817.77
5.5.230.0090.00915.42
5.5.220.0070.01015.39
5.5.210.0060.01215.34
5.5.200.0070.01115.29
5.5.190.0030.01615.25
5.5.180.0090.00915.32
5.5.170.0000.01915.24
5.5.160.0090.00915.30
5.5.150.0000.02015.37
5.5.140.0110.00815.17
5.5.130.0130.00815.45
5.5.120.0130.00715.58
5.5.110.0080.01615.29
5.5.100.0180.00415.35
5.5.90.0150.00915.08
5.5.80.0150.00415.37
5.5.70.0060.01415.43
5.5.60.0080.01115.57
5.5.50.0060.01415.31
5.5.40.0110.00715.45
5.5.30.0060.01215.39
5.5.20.0100.00815.19
5.5.10.0120.00615.32
5.5.00.0090.00915.29
5.4.450.0090.03215.85
5.4.440.0440.03615.79
5.4.430.0070.03515.92
5.4.420.0110.02715.93
5.4.410.0320.03515.87
5.4.400.0420.03915.57
5.4.390.0530.02515.76
5.4.380.0190.02915.43
5.4.370.0270.02615.39
5.4.360.0190.03215.34
5.4.350.0230.02815.51
5.4.340.0150.03515.52
5.4.330.0070.00712.12
5.4.320.0050.02212.38
5.4.310.0050.02412.36
5.4.300.0060.02212.36
5.4.290.0050.02412.34
5.4.280.0070.02212.36
5.4.270.0100.02312.33
5.4.260.0120.02012.28
5.4.250.0080.02112.27
5.4.240.0050.02312.28
5.4.230.0070.02112.27
5.4.220.0100.01812.23
5.4.210.0050.02612.26
5.4.200.0110.02012.25
5.4.190.0050.02412.26
5.4.180.0070.02412.34
5.4.170.0030.02412.23
5.4.160.0060.02212.31
5.4.150.0090.02212.26
5.4.140.0080.01912.24
5.4.130.0070.02012.23
5.4.120.0050.02212.13
5.4.110.0050.02612.20
5.4.100.0070.02212.16
5.4.90.0030.02612.08
5.4.80.0060.02212.20
5.4.70.0090.01812.22
5.4.60.0060.02212.11
5.4.50.0070.02112.19
5.4.40.0070.02212.09
5.4.30.0050.02212.19
5.4.20.0050.02312.08
5.4.10.0090.01912.16
5.4.00.0050.02311.86
5.3.290.0100.02012.86
5.3.280.0080.02312.75
5.3.270.0060.02312.76
5.3.260.0060.02312.72
5.3.250.0060.02212.82
5.3.240.0090.01912.71
5.3.230.0030.02512.69
5.3.220.0060.02212.67
5.3.210.0080.02112.72
5.3.200.0080.02212.81
5.3.190.0060.02212.76
5.3.180.0040.02412.76
5.3.170.0050.02212.76
5.3.160.0020.02512.78
5.3.150.0080.02112.76
5.3.140.0060.02212.74
5.3.130.0090.02112.79
5.3.120.0050.02412.79
5.3.110.0090.02012.79
5.3.100.0070.02112.53
5.3.90.0020.02512.50
5.3.80.0100.01912.41
5.3.70.0020.02612.47
5.3.60.0070.02112.44
5.3.50.0050.02312.52
5.3.40.0090.02012.37
5.3.30.0060.02212.43
5.3.20.0070.02512.30
5.3.10.0080.01912.13
5.3.00.0030.02412.11
5.2.170.0070.01710.50
5.2.160.0070.01610.53
5.2.150.0060.01810.52
5.2.140.0100.01410.63
5.2.130.0080.01910.46
5.2.120.0060.01710.54
5.2.110.0070.01510.56
5.2.100.0050.01810.50
5.2.90.0060.01610.55
5.2.80.0030.01910.57
5.2.70.0070.01710.43
5.2.60.0020.02110.38
5.2.50.0040.02010.44
5.2.40.0060.01710.39
5.2.30.0040.02310.43
5.2.20.0090.01410.30
5.2.10.0060.01710.27
5.2.00.0050.01810.16
5.1.60.0030.0179.46
5.1.50.0030.0179.43
5.1.40.0050.0159.53
5.1.30.0050.0179.79
5.1.20.0010.0209.73
5.1.10.0040.0159.48
5.1.00.0030.0179.51
5.0.50.0060.0128.44
5.0.40.0050.0148.34
5.0.30.0040.0208.24
5.0.20.0020.0148.22
5.0.10.0060.0128.21
5.0.00.0020.0208.21
4.4.90.0050.0077.46
4.4.80.0010.0107.45
4.4.70.0030.0097.45
4.4.60.0040.0077.45
4.4.50.0020.0097.46
4.4.40.0040.0137.43
4.4.30.0020.0097.45
4.4.20.0020.0107.49
4.4.10.0010.0107.50
4.4.00.0020.0177.45
4.3.110.0050.0077.40
4.3.100.0030.0097.40
4.3.90.0040.0077.39
4.3.80.0040.0127.36
4.3.70.0030.0107.38
4.3.60.0020.0097.38
4.3.50.0020.0107.38
4.3.40.0040.0127.34
4.3.30.0020.0106.73
4.3.20.0050.0076.72
4.3.10.0030.0086.70
4.3.00.0030.0158.23

preferences:
42.59 ms | 401 KiB | 5 Q