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"); } 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.0070.01318.28
8.3.50.0110.00922.80
8.3.40.0110.00418.81
8.3.30.0070.00719.09
8.3.20.0000.00820.30
8.3.10.0050.00323.70
8.3.00.0080.00019.25
8.2.180.0140.00718.08
8.2.170.0090.00622.96
8.2.160.0060.00920.27
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00321.10
8.2.110.0090.00020.52
8.2.100.0030.00917.97
8.2.90.0090.00018.99
8.2.80.0030.00617.97
8.2.70.0030.00617.63
8.2.60.0040.00417.91
8.2.50.0000.00818.07
8.2.40.0040.00418.09
8.2.30.0040.00417.96
8.2.20.0000.00717.60
8.2.10.0070.00017.96
8.2.00.0000.00717.69
8.1.280.0110.00725.92
8.1.270.0030.00723.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.08
8.1.230.0030.00719.17
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0030.00917.23
8.1.190.0030.00617.00
8.1.180.0040.00418.10
8.1.170.0000.00818.46
8.1.160.0050.00322.05
8.1.150.0040.00418.88
8.1.140.0000.00717.43
8.1.130.0050.00317.86
8.1.120.0000.00717.43
8.1.110.0040.00417.32
8.1.100.0050.00317.44
8.1.90.0070.00017.40
8.1.80.0080.00017.26
8.1.70.0000.00717.41
8.1.60.0090.00017.45
8.1.50.0030.00517.52
8.1.40.0040.00417.48
8.1.30.0000.00817.58
8.1.20.0040.00417.63
8.1.10.0000.00817.55
8.1.00.0000.00817.50
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0070.00018.56
8.0.270.0070.00016.87
8.0.260.0030.00317.23
8.0.250.0000.00716.87
8.0.240.0040.00417.01
8.0.230.0030.00316.86
8.0.220.0070.00016.96
8.0.210.0040.00416.91
8.0.200.0060.00016.94
8.0.190.0030.00516.97
8.0.180.0000.00816.89
8.0.170.0000.00716.92
8.0.160.0000.00716.76
8.0.150.0040.00416.79
8.0.140.0000.00816.74
8.0.130.0000.00613.38
8.0.120.0000.00716.91
8.0.110.0040.00416.94
8.0.100.0070.00016.92
8.0.90.0040.00416.84
8.0.80.0060.01116.90
8.0.70.0000.00716.79
8.0.60.0000.00716.88
8.0.50.0050.00216.84
8.0.30.0090.01117.24
8.0.20.0160.00517.40
8.0.10.0040.00417.12
8.0.00.0100.00916.87
7.4.330.0000.00515.09
7.4.320.0000.00716.56
7.4.300.0000.00716.46
7.4.290.0000.00916.54
7.4.280.0050.00216.57
7.4.270.0040.00416.46
7.4.260.0060.00316.65
7.4.250.0000.00716.50
7.4.240.0020.00616.63
7.4.230.0000.00716.52
7.4.220.0090.01316.49
7.4.210.0110.00316.64
7.4.200.0040.00416.47
7.4.160.0100.01016.40
7.4.150.0100.01017.40
7.4.140.0140.01317.86
7.4.130.0090.00816.58
7.4.120.0090.00716.60
7.4.110.0100.00616.51
7.4.100.0040.01316.74
7.4.90.0040.01816.35
7.4.80.0130.00319.39
7.4.70.0120.00616.58
7.4.60.0080.00816.47
7.4.50.0050.00916.48
7.4.40.0060.00916.12
7.4.30.0080.00816.18
7.4.20.0090.00616.27
7.4.10.0100.00716.12
7.4.00.0120.00815.93
7.3.330.0050.00013.18
7.3.320.0030.00313.21
7.3.310.0000.00716.38
7.3.300.0070.00016.27
7.3.290.0090.00616.38
7.3.280.0100.00716.43
7.3.270.0120.00617.40
7.3.260.0080.00816.79
7.3.250.0130.00916.38
7.3.240.0040.01416.63
7.3.230.0060.01216.46
7.3.210.0150.00716.34
7.3.200.0130.00619.39
7.3.190.0120.00916.34
7.3.180.0120.00416.50
7.3.170.0160.00316.29
7.3.160.0060.01016.36
7.3.150.0120.00316.14
7.3.140.0110.00616.21
7.3.130.0080.00816.39
7.3.120.0120.00816.31
7.3.110.0190.00016.38
7.3.100.0030.01316.10
7.3.90.0060.00916.24
7.3.80.0170.00016.48
7.3.70.0070.01116.18
7.3.60.0070.01016.36
7.3.50.0030.01516.28
7.3.40.0030.01216.38
7.3.30.0060.00916.30
7.3.20.0060.00916.27
7.3.10.0130.00316.14
7.3.00.0180.00916.22
7.2.330.0100.01316.65
7.2.320.0140.00316.77
7.2.310.0050.01116.52
7.2.300.0040.01316.33
7.2.290.0110.00816.57
7.2.280.0150.00316.51
7.2.270.0070.01016.49
7.2.260.0060.00916.57
7.2.250.0040.01616.40
7.2.240.0090.00916.44
7.2.230.0080.00816.25
7.2.220.0080.00816.38
7.2.210.0140.00316.28
7.2.200.0150.00316.34
7.2.190.0100.00716.41
7.2.180.0120.00616.53
7.2.170.0060.00916.34
7.2.160.0070.01016.45
7.2.150.0100.00716.53
7.2.140.0060.01016.50
7.2.130.0090.00916.52
7.2.120.0140.00316.29
7.2.110.0070.01016.46
7.2.100.0080.00816.47
7.2.90.0150.00416.52
7.2.80.0060.01316.43
7.2.70.0130.00816.54
7.2.60.0140.00416.60
7.2.50.0090.00916.53
7.2.40.0100.01416.55
7.2.30.0030.01616.52
7.2.20.0180.00616.49
7.2.10.0110.00816.44
7.2.00.0080.00817.92
7.1.330.0070.01115.35
7.1.320.0120.00315.36
7.1.310.0080.00815.43
7.1.300.0090.00615.21
7.1.290.0060.00915.34
7.1.280.0140.00315.28
7.1.270.0090.00615.48
7.1.260.0110.00515.34
7.1.250.0000.01615.51
7.1.240.0040.01215.43
7.1.230.0060.01015.54
7.1.220.0100.00615.29
7.1.210.0130.00315.32
7.1.200.0080.00615.43
7.1.190.0150.00815.71
7.1.180.0120.00915.27
7.1.170.0040.01115.23
7.1.160.0030.01415.18
7.1.150.0110.00615.37
7.1.140.0080.00815.30
7.1.130.0080.00815.69
7.1.120.0030.01215.39
7.1.110.0060.00915.46
7.1.100.0070.00716.78
7.1.90.0110.00515.26
7.1.80.0030.01215.43
7.1.70.0090.00816.25
7.1.60.0070.01017.41
7.1.50.0110.00815.97
7.1.40.0120.00315.32
7.1.30.0080.00815.48
7.1.20.0090.00615.50
7.1.10.0040.01215.36
7.1.00.0070.04118.98
7.0.330.0030.01215.16
7.0.320.0060.00915.11
7.0.310.0110.00715.07
7.0.300.0140.00614.87
7.0.290.0090.01214.97
7.0.280.0070.00715.09
7.0.270.0100.00614.95
7.0.260.0060.00915.10
7.0.250.0040.01315.03
7.0.240.0120.00314.97
7.0.230.0090.00615.05
7.0.220.0180.00315.05
7.0.210.0110.00415.06
7.0.200.0050.00915.99
7.0.190.0040.01214.89
7.0.180.0080.00815.17
7.0.170.0110.00415.15
7.0.160.0040.01115.05
7.0.150.0130.00315.02
7.0.140.0100.03518.55
7.0.130.0090.00915.03
7.0.120.0040.01215.15
7.0.110.0030.01215.14
7.0.100.0130.00314.97
7.0.90.0070.01115.13
7.0.80.0120.00614.95
7.0.70.0060.00915.07
7.0.60.0100.03817.52
7.0.50.0130.02216.55
7.0.40.0100.04317.63
7.0.30.0170.02017.64
7.0.20.0110.03017.69
7.0.10.0020.03317.65
7.0.00.0070.04717.55
5.6.400.0110.00715.70
5.6.390.0160.00315.84
5.6.380.0140.00315.71
5.6.370.0150.00415.94
5.6.360.0060.01215.71
5.6.350.0080.01116.22
5.6.340.0000.01715.79
5.6.330.0080.00915.75
5.6.320.0170.00715.73
5.6.310.0120.00915.89
5.6.300.0090.00915.88
5.6.290.0040.01415.71
5.6.280.0030.04518.45
5.6.270.0180.00315.62
5.6.260.0000.01715.62
5.6.250.0090.00915.78
5.6.240.0090.01215.54
5.6.230.0000.01815.62
5.6.220.0140.00615.46
5.6.210.0040.03118.21
5.6.200.0050.02816.82
5.6.190.0030.05218.26
5.6.180.0160.04218.19
5.6.170.0160.03018.28
5.6.160.0080.04118.10
5.6.150.0090.03416.93
5.6.140.0120.02816.92
5.6.130.0130.03816.75
5.6.120.0080.04018.38
5.6.110.0070.04518.33
5.6.100.0080.04218.45
5.6.90.0080.02318.32
5.6.80.0070.04518.18
5.6.70.0100.00715.72
5.6.60.0060.01215.47
5.6.50.0110.00715.71
5.6.40.0080.01015.59
5.6.30.0090.00915.80
5.6.20.0030.01815.74
5.6.10.0080.01215.70
5.6.00.0030.02315.66
5.5.380.0120.00615.58
5.5.370.0060.01315.46
5.5.360.0080.01215.20
5.5.350.0130.04717.80
5.5.340.0070.02316.67
5.5.330.0130.03817.92
5.5.320.0140.02817.89
5.5.310.0170.04317.91
5.5.300.0060.02316.79
5.5.290.0020.03716.66
5.5.280.0090.02718.14
5.5.270.0050.04917.96
5.5.260.0040.04818.22
5.5.250.0080.02418.07
5.5.240.0070.03817.80
5.5.230.0070.01015.39
5.5.220.0120.00615.54
5.5.210.0060.01315.30
5.5.200.0230.00315.47
5.5.190.0060.01615.12
5.5.180.0070.01115.18
5.5.170.0060.01315.13
5.5.160.0090.01115.19
5.5.150.0140.00315.30
5.5.140.0140.00315.42
5.5.130.0070.01115.33
5.5.120.0060.01515.48
5.5.110.0080.01415.38
5.5.100.0110.00815.42
5.5.90.0090.01515.42
5.5.80.0100.01015.39
5.5.70.0110.00615.29
5.5.60.0140.00315.50
5.5.50.0070.01015.48
5.5.40.0040.01415.54
5.5.30.0070.01015.39
5.5.20.0030.01615.27
5.5.10.0120.00915.50
5.5.00.0070.01015.38
5.4.450.0120.02315.86
5.4.440.0100.02315.89
5.4.430.0080.02715.79
5.4.420.0070.02815.82
5.4.410.0170.02015.78
5.4.400.0100.02615.63
5.4.390.0160.02415.63
5.4.380.0180.03615.48
5.4.370.0240.02715.49
5.4.360.0210.03015.46
5.4.350.0400.03115.50
5.4.340.0170.03015.46
5.4.330.0080.00812.18
5.4.320.0060.02212.40
5.4.310.0100.02212.35
5.4.300.0060.02212.36
5.4.290.0040.02612.42
5.4.280.0040.02612.41
5.4.270.0070.02612.32
5.4.260.0040.02512.31
5.4.250.0060.02412.33
5.4.240.0080.01912.31
5.4.230.0060.02212.33
5.4.220.0090.01812.26
5.4.210.0060.02612.32
5.4.200.0060.02612.38
5.4.190.0090.01712.30
5.4.180.0060.02012.31
5.4.170.0080.02412.29
5.4.160.0080.02112.23
5.4.150.0060.02012.37
5.4.140.0060.02112.28
5.4.130.0080.02312.20
5.4.120.0060.02012.19
5.4.110.0080.01812.14
5.4.100.0090.01912.18
5.4.90.0070.02212.10
5.4.80.0060.02712.13
5.4.70.0060.02312.13
5.4.60.0060.02312.12
5.4.50.0060.02212.15
5.4.40.0020.02712.11
5.4.30.0030.02712.16
5.4.20.0040.02412.05
5.4.10.0050.02012.17
5.4.00.0090.01811.86
5.3.290.0060.02612.82
5.3.280.0050.02312.70
5.3.270.0030.02712.80
5.3.260.0090.01912.71
5.3.250.0030.02412.80
5.3.240.0080.02112.69
5.3.230.0100.01912.70
5.3.220.0040.02612.82
5.3.210.0060.02512.75
5.3.200.0050.02312.67
5.3.190.0060.02112.76
5.3.180.0080.01912.77
5.3.170.0070.02012.86
5.3.160.0090.01912.76
5.3.150.0080.02012.83
5.3.140.0040.02312.73
5.3.130.0090.01912.74
5.3.120.0040.02412.76
5.3.110.0010.02712.79
5.3.100.0040.02412.46
5.3.90.0050.02312.48
5.3.80.0070.02012.42
5.3.70.0060.02112.39
5.3.60.0020.02412.44
5.3.50.0080.01912.37
5.3.40.0040.02612.52
5.3.30.0080.02012.38
5.3.20.0050.02112.25
5.3.10.0060.02012.16
5.3.00.0070.02012.18
5.2.170.0060.01710.60
5.2.160.0050.02010.54
5.2.150.0040.02010.59
5.2.140.0060.01610.49
5.2.130.0060.01910.48
5.2.120.0070.01610.61
5.2.110.0040.01910.45
5.2.100.0040.02210.56
5.2.90.0070.01910.54
5.2.80.0050.02310.44
5.2.70.0070.01810.45
5.2.60.0070.01710.52
5.2.50.0080.01610.45
5.2.40.0080.01610.40
5.2.30.0030.01910.38
5.2.20.0030.02110.44
5.2.10.0050.01710.28
5.2.00.0080.01710.18
5.1.60.0050.0169.46
5.1.50.0070.0149.46
5.1.40.0040.0159.56
5.1.30.0050.0169.79
5.1.20.0070.0159.65
5.1.10.0060.0149.50
5.1.00.0040.0219.46
5.0.50.0080.0118.40
5.0.40.0020.0178.36
5.0.30.0050.0188.23
5.0.20.0070.0138.22
5.0.10.0070.0128.21
5.0.00.0040.0178.21
4.4.90.0020.0107.46
4.4.80.0020.0097.45
4.4.70.0020.0097.45
4.4.60.0020.0127.45
4.4.50.0020.0097.46
4.4.40.0030.0137.43
4.4.30.0030.0117.45
4.4.20.0030.0087.49
4.4.10.0030.0127.50
4.4.00.0030.0167.45
4.3.110.0020.0097.41
4.3.100.0030.0097.40
4.3.90.0050.0077.38
4.3.80.0030.0147.36
4.3.70.0030.0127.38
4.3.60.0020.0087.38
4.3.50.0030.0097.38
4.3.40.0040.0137.34
4.3.30.0030.0096.73
4.3.20.0030.0136.72
4.3.10.0030.0106.70
4.3.00.0040.00714.28

preferences:
50.99 ms | 401 KiB | 5 Q