3v4l.org

run code in 300+ PHP versions simultaneously
<?php # basic test string_lt('a', 'z'); string_lt('z', 'a'); # numeric strings string_lt('22', '123'); string_lt('123', '22'); # non-numeric strings string_lt('bb', 'abc'); string_lt('abc', 'bb'); # non-numeric strings with numbers in # should be the same as "numeric strings" if strcmp() really does string comparison string_lt('22x', '123x'); string_lt('123x', '22x'); function string_lt($str1, $str2) { # < operator if ($str1 < $str2) { say("$str1 < $str2"); } } 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.0060.00918.55
8.3.50.0120.00522.82
8.3.40.0070.00718.85
8.3.30.0140.00019.17
8.3.20.0040.00420.37
8.3.10.0080.00023.71
8.3.00.0080.00019.26
8.2.180.0070.00718.16
8.2.170.0150.00022.96
8.2.160.0090.00620.55
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0030.00521.09
8.2.110.0130.00320.38
8.2.100.0040.00718.16
8.2.90.0000.00819.05
8.2.80.0040.00417.97
8.2.70.0070.00417.38
8.2.60.0080.00017.80
8.2.50.0080.00018.07
8.2.40.0060.00318.22
8.2.30.0040.00418.05
8.2.20.0040.00417.63
8.2.10.0040.00418.14
8.2.00.0040.00417.72
8.1.280.0140.00425.92
8.1.270.0060.00323.87
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00724.02
8.1.230.0000.01119.05
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0060.00617.23
8.1.190.0030.00517.13
8.1.180.0080.00018.10
8.1.170.0040.00418.53
8.1.160.0000.00722.12
8.1.150.0020.00518.75
8.1.140.0040.00417.43
8.1.130.0030.00317.94
8.1.120.0040.00417.48
8.1.110.0000.00817.45
8.1.100.0030.00517.35
8.1.90.0000.00717.32
8.1.80.0040.00417.46
8.1.70.0040.00417.38
8.1.60.0060.00317.60
8.1.50.0080.00017.35
8.1.40.0040.00417.44
8.1.30.0040.00417.50
8.1.20.0040.00417.57
8.1.10.0030.00517.56
8.1.00.0030.00517.47
8.0.300.0050.00318.77
8.0.290.0070.00016.75
8.0.280.0000.00718.44
8.0.270.0000.00717.21
8.0.260.0000.00617.34
8.0.250.0030.00316.97
8.0.240.0050.00316.89
8.0.230.0000.00717.00
8.0.220.0000.00716.82
8.0.210.0030.00316.95
8.0.200.0000.00616.97
8.0.190.0080.00017.00
8.0.180.0050.00317.02
8.0.170.0040.00416.88
8.0.160.0050.00316.83
8.0.150.0040.00416.83
8.0.140.0070.00016.82
8.0.130.0030.00313.33
8.0.120.0050.00216.88
8.0.110.0020.00516.95
8.0.100.0040.00417.00
8.0.90.0090.00016.75
8.0.80.0100.01316.92
8.0.70.0000.00716.83
8.0.60.0050.00316.78
8.0.50.0070.00017.00
8.0.30.0110.01117.01
8.0.20.0160.00617.46
8.0.10.0030.00517.12
8.0.00.0140.01016.77
7.4.330.0030.00315.15
7.4.320.0000.00816.44
7.4.300.0060.00016.63
7.4.290.0030.00316.65
7.4.280.0040.00416.59
7.4.270.0030.00316.66
7.4.260.0030.00516.50
7.4.250.0040.00416.55
7.4.240.0000.00816.64
7.4.230.0040.00416.34
7.4.220.0110.01116.67
7.4.210.0060.00916.64
7.4.200.0030.00516.64
7.4.160.0080.00816.48
7.4.150.0150.01017.40
7.4.140.0090.00917.86
7.4.130.0120.00516.56
7.4.120.0090.00816.64
7.4.110.0120.00416.66
7.4.100.0080.01116.67
7.4.90.0100.00716.34
7.4.80.0100.00719.39
7.4.70.0130.00716.73
7.4.60.0080.01116.43
7.4.50.0080.00716.38
7.4.40.0170.00016.15
7.4.30.0110.01016.31
7.4.20.0000.01616.22
7.4.10.0110.00815.87
7.4.00.0080.01015.73
7.3.330.0030.00213.39
7.3.320.0000.00513.27
7.3.310.0030.00316.46
7.3.300.0070.00016.44
7.3.290.0120.00316.32
7.3.280.0080.00716.42
7.3.270.0120.00617.40
7.3.260.0130.00416.53
7.3.250.0050.01116.51
7.3.240.0080.00816.59
7.3.230.0070.01016.43
7.3.210.0070.01116.66
7.3.200.0090.00616.59
7.3.190.0060.00916.41
7.3.180.0080.00816.42
7.3.170.0070.01416.43
7.3.160.0070.01016.36
7.3.150.0110.00516.14
7.3.140.0090.00916.36
7.3.130.0090.00615.49
7.3.120.0060.01015.65
7.3.110.0070.01015.70
7.3.100.0060.01015.69
7.3.90.0080.00915.72
7.3.80.0050.00915.62
7.3.70.0100.00415.67
7.3.60.0070.00815.71
7.3.50.0070.00815.65
7.3.40.0050.00815.62
7.3.30.0070.00915.55
7.3.20.0070.00716.95
7.3.10.0100.00616.88
7.3.00.0110.00316.79
7.2.330.0160.00316.75
7.2.320.0070.01016.81
7.2.310.0030.01716.34
7.2.300.0070.01016.43
7.2.290.0140.00516.18
7.2.280.0090.00916.42
7.2.270.0070.01316.45
7.2.260.0080.00815.83
7.2.250.0090.00915.90
7.2.240.0070.00915.73
7.2.230.0080.00915.92
7.2.220.0070.00915.67
7.2.210.0090.00815.71
7.2.200.0050.00915.74
7.2.190.0090.00715.80
7.2.180.0050.00915.83
7.2.170.0030.01315.67
7.2.160.0090.00515.76
7.2.150.0040.01117.15
7.2.140.0040.01317.24
7.2.130.0080.00717.17
7.2.120.0060.00917.04
7.2.110.0090.00717.07
7.2.100.0080.00817.10
7.2.90.0070.01017.01
7.2.80.0080.00817.07
7.2.70.0050.01116.93
7.2.60.0090.00716.99
7.2.50.0070.00617.06
7.2.40.0060.01217.17
7.2.30.0110.00517.14
7.2.20.0120.00416.94
7.2.10.0070.01016.99
7.2.00.0050.01117.44
7.1.330.0090.00916.06
7.1.320.0070.00716.19
7.1.310.0060.00815.98
7.1.300.0060.01016.10
7.1.290.0060.00615.98
7.1.280.0060.00916.05
7.1.270.0050.00915.99
7.1.260.0070.00815.98
7.1.250.0070.00615.96
7.1.240.0050.00916.11
7.1.230.0070.00816.01
7.1.220.0050.01116.04
7.1.210.0070.00816.00
7.1.200.0040.01015.84
7.1.190.0080.00716.06
7.1.180.0060.00716.06
7.1.170.0040.00915.99
7.1.160.0070.01016.03
7.1.150.0050.00816.17
7.1.140.0050.00916.12
7.1.130.0070.00816.12
7.1.120.0090.00616.01
7.1.110.0090.00516.05
7.1.100.0080.00516.35
7.1.90.0040.01115.98
7.1.80.0090.00716.09
7.1.70.0060.00816.32
7.1.60.0080.00816.75
7.1.50.0090.00716.22
7.1.40.0100.00616.11
7.1.30.0080.00616.12
7.1.20.0080.00816.07
7.1.10.0060.00616.05
7.1.00.0060.01917.39
7.0.330.0050.00915.72
7.0.320.0070.00615.77
7.0.310.0070.00615.63
7.0.300.0060.00815.72
7.0.290.0060.00915.65
7.0.280.0050.00815.73
7.0.270.0070.00715.73
7.0.260.0080.00715.69
7.0.250.0120.00315.67
7.0.240.0080.00615.70
7.0.230.0070.00915.73
7.0.220.0150.00915.79
7.0.210.0080.00515.65
7.0.200.0040.01015.93
7.0.190.0050.00915.67
7.0.180.0050.00815.85
7.0.170.0050.00815.77
7.0.160.0070.00515.77
7.0.150.0040.01015.79
7.0.140.0090.01817.04
7.0.130.0050.00915.69
7.0.120.0080.00615.74
7.0.110.0070.00815.68
7.0.100.0070.00615.74
7.0.90.0070.00815.74
7.0.80.0100.00515.55
7.0.70.0070.00815.64
7.0.60.0070.02016.54
7.0.50.0090.01716.04
7.0.40.0080.01815.37
7.0.30.0130.02215.45
7.0.20.0040.01915.49
7.0.10.0040.02715.41
7.0.00.0050.02315.40
5.6.400.0050.01015.08
5.6.390.0060.00815.20
5.6.380.0070.00915.23
5.6.370.0060.00914.94
5.6.360.0060.00915.05
5.6.350.0050.01015.09
5.6.340.0090.00815.16
5.6.330.0060.00915.29
5.6.320.0070.00915.18
5.6.310.0070.00715.19
5.6.300.0060.01115.03
5.6.290.0080.01014.98
5.6.280.0060.02216.33
5.6.270.0070.00914.97
5.6.260.0050.00914.98
5.6.250.0050.01015.12
5.6.240.0100.00714.99
5.6.230.0080.00615.04
5.6.220.0080.00915.09
5.6.210.0070.01916.04
5.6.200.0060.01615.63
5.6.190.0080.02216.14
5.6.180.0120.01916.17
5.6.170.0090.01916.21
5.6.160.0060.01816.06
5.6.150.0090.01915.69
5.6.140.0060.01615.70
5.6.130.0060.01915.63
5.6.120.0100.01816.28
5.6.110.0080.02316.25
5.6.100.0060.02216.27
5.6.90.0060.02416.33
5.6.80.0090.01516.09
5.6.70.0060.01214.95
5.6.60.0050.01215.01
5.6.50.0070.01014.94
5.6.40.0090.00714.95
5.6.30.0060.00915.04
5.6.20.0060.00715.09
5.6.10.0060.00715.08
5.6.00.0120.00414.93
5.5.380.0100.00514.86
5.5.370.0070.00814.81
5.5.360.0060.00714.63
5.5.350.0050.02315.80
5.5.340.0040.02515.54
5.5.330.0090.02115.78
5.5.320.0640.01415.85
5.5.310.0130.01915.84
5.5.300.0080.01515.32
5.5.290.0050.01615.29
5.5.280.0080.02215.96
5.5.270.0080.02115.98
5.5.260.0110.01816.08
5.5.250.0080.02315.88
5.5.240.0090.01815.76
5.5.230.0050.01114.66
5.5.220.0100.00714.68
5.5.210.0060.01014.77
5.5.200.0050.00814.68
5.5.190.0060.00914.61
5.5.180.0070.00914.59
5.5.170.0050.00814.70
5.5.160.0060.00714.66
5.5.150.0040.01014.59
5.5.140.0090.00714.63
5.5.130.0080.00814.73
5.5.120.0060.01114.67
5.5.110.0070.00614.82
5.5.100.0070.00814.68
5.5.90.0080.00814.73
5.5.80.0040.01114.71
5.5.70.0060.00814.65
5.5.60.0070.00914.66
5.5.50.0110.00414.76
5.5.40.0040.00814.73
5.5.30.0100.00614.73
5.5.20.0030.01314.69
5.5.10.0050.00914.56
5.5.00.0110.00514.59
5.4.450.0060.02013.53
5.4.440.0070.01313.58
5.4.430.0060.01513.62
5.4.420.0060.01213.51
5.4.410.0050.01513.61
5.4.400.0070.01113.48
5.4.390.0080.01313.46
5.4.380.0150.01913.43
5.4.370.0090.01813.41
5.4.360.0090.01413.41
5.4.350.0090.01813.45
5.4.340.0110.01513.46
5.4.330.0050.00812.17
5.4.320.0050.01212.23
5.4.310.0030.01612.20
5.4.300.0030.01512.18
5.4.290.0060.01212.14
5.4.280.0060.01012.16
5.4.270.0050.01512.20
5.4.260.0050.01412.18
5.4.250.0060.01312.18
5.4.240.0060.01312.14
5.4.230.0060.01112.19
5.4.220.0050.01212.16
5.4.210.0070.01012.17
5.4.200.0030.01412.12
5.4.190.0060.01312.13
5.4.180.0040.01312.17
5.4.170.0040.01412.18
5.4.160.0060.01012.12
5.4.150.0040.01312.08
5.4.140.0030.01412.10
5.4.130.0040.01312.08
5.4.120.0070.01112.09
5.4.110.0060.01212.08
5.4.100.0050.01412.07
5.4.90.0080.00912.08
5.4.80.0070.01012.13
5.4.70.0070.01212.06
5.4.60.0040.01412.11
5.4.50.0050.01312.12
5.4.40.0040.01312.11
5.4.30.0060.01512.14
5.4.20.0070.01012.08
5.4.10.0030.01312.13
5.4.00.0050.01212.00
5.3.290.0080.02512.87
5.3.280.0080.02612.75
5.3.270.0040.02612.78
5.3.260.0070.02612.72
5.3.250.0050.02912.88
5.3.240.0110.02312.66
5.3.230.0040.02412.78
5.3.220.0040.02412.67
5.3.210.0050.02512.66
5.3.200.0080.02112.68
5.3.190.0090.02112.75
5.3.180.0040.02712.77
5.3.170.0070.02212.85
5.3.160.0070.02412.84
5.3.150.0040.02712.84
5.3.140.0070.02512.82
5.3.130.0070.02312.78
5.3.120.0080.02212.80
5.3.110.0050.02512.79
5.3.100.0060.02312.46
5.3.90.0080.02812.48
5.3.80.0090.02212.50
5.3.70.0070.02212.43
5.3.60.0060.02112.43
5.3.50.0060.02212.39
5.3.40.0090.02012.44
5.3.30.0070.02012.36
5.3.20.0050.02112.24
5.3.10.0060.02212.14
5.3.00.0050.02212.19
5.2.170.0040.02010.59
5.2.160.0060.01710.52
5.2.150.0030.02610.59
5.2.140.0060.02010.49
5.2.130.0080.01510.54
5.2.120.0080.01510.46
5.2.110.0040.01810.51
5.2.100.0060.01610.53
5.2.90.0020.02110.54
5.2.80.0050.02010.45
5.2.70.0090.01610.47
5.2.60.0060.01910.45
5.2.50.0060.01710.41
5.2.40.0060.01710.41
5.2.30.0090.01610.39
5.2.20.0050.01810.28
5.2.10.0050.01810.20
5.2.00.0030.02010.12
5.1.60.0080.0129.53
5.1.50.0030.0179.49
5.1.40.0020.0199.56
5.1.30.0060.0159.71
5.1.20.0060.0169.64
5.1.10.0050.0169.57
5.1.00.0050.0169.54
5.0.50.0020.0168.50
5.0.40.0050.0128.33
5.0.30.0050.0188.23
5.0.20.0050.0118.22
5.0.10.0050.0128.21
5.0.00.0040.0178.21
4.4.90.0040.0097.46
4.4.80.0040.0097.45
4.4.70.0040.0097.45
4.4.60.0020.0117.45
4.4.50.0040.0117.46
4.4.40.0030.0147.42
4.4.30.0040.0097.45
4.4.20.0040.0097.49
4.4.10.0040.0097.49
4.4.00.0050.0147.45
4.3.110.0050.0077.41
4.3.100.0020.0097.40
4.3.90.0030.0107.39
4.3.80.0050.0137.36
4.3.70.0030.0107.38
4.3.60.0030.0097.38
4.3.50.0040.0087.38
4.3.40.0030.0127.34
4.3.30.0020.0106.73
4.3.20.0040.0096.72
4.3.10.0040.0076.70
4.3.00.0030.01114.28

preferences:
32.88 ms | 401 KiB | 5 Q