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) < 0) { say("strcmp says: $str1 < $str2"); } if (strcmp($str2, $str1) < 0) { say("strcmp says: $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.40.0120.00318.84
8.3.30.0100.00319.04
8.3.20.0040.00420.16
8.3.10.0070.00023.65
8.3.00.0050.00319.38
8.2.170.0070.01022.96
8.2.160.0070.00720.48
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00421.08
8.2.110.0040.00422.11
8.2.100.0080.00317.91
8.2.90.0030.00619.09
8.2.80.0000.00817.97
8.2.70.0000.00917.50
8.2.60.0030.00518.03
8.2.50.0000.00818.07
8.2.40.0050.00318.22
8.2.30.0000.00717.96
8.2.20.0050.00317.57
8.2.10.0000.00718.04
8.2.00.0040.00417.59
8.1.270.0080.00023.76
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.73
8.1.230.0060.00619.36
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0090.00017.23
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0060.00318.52
8.1.160.0000.00721.93
8.1.150.0050.00218.86
8.1.140.0000.00817.38
8.1.130.0000.00817.80
8.1.120.0000.00717.41
8.1.110.0040.00417.31
8.1.100.0000.00717.47
8.1.90.0000.00717.40
8.1.80.0040.00417.38
8.1.70.0000.00717.38
8.1.60.0040.00417.43
8.1.50.0030.00517.54
8.1.40.0050.00217.54
8.1.30.0000.00817.54
8.1.20.0000.00817.61
8.1.10.0000.00917.56
8.1.00.0040.00417.53
8.0.300.0040.00418.77
8.0.290.0050.00216.88
8.0.280.0040.00418.39
8.0.270.0000.00717.29
8.0.260.0030.00317.35
8.0.250.0000.00716.92
8.0.240.0040.00416.98
8.0.230.0000.00716.97
8.0.220.0040.00416.90
8.0.210.0000.00716.82
8.0.200.0000.00617.00
8.0.190.0040.00416.98
8.0.180.0040.00416.94
8.0.170.0080.00016.95
8.0.160.0030.00317.03
8.0.150.0000.00716.85
8.0.140.0070.00016.81
8.0.130.0000.00513.29
8.0.120.0080.00016.88
8.0.110.0040.00416.89
8.0.100.0000.00716.84
8.0.90.0100.00016.75
8.0.80.0070.01016.88
8.0.70.0000.00816.96
8.0.60.0000.00816.80
8.0.50.0030.00516.79
8.0.30.0150.00517.21
8.0.20.0110.00817.42
8.0.10.0070.00016.93
8.0.00.0080.01016.86
7.4.330.0030.00315.02
7.4.320.0000.00616.47
7.4.300.0040.00416.53
7.4.290.0000.00716.63
7.4.280.0000.00716.68
7.4.270.0000.00716.47
7.4.260.0070.00016.51
7.4.250.0040.00416.50
7.4.240.0040.00416.54
7.4.230.0000.00716.75
7.4.220.0100.00716.68
7.4.210.0040.01216.60
7.4.200.0000.00816.42
7.4.160.0110.00616.67
7.4.150.0160.00917.40
7.4.140.0070.01317.86
7.4.130.0160.00216.58
7.4.120.0080.00816.44
7.4.110.0080.00816.45
7.4.100.0090.01016.49
7.4.90.0030.01416.60
7.4.80.0100.01019.39
7.4.70.0040.01316.43
7.4.60.0110.00916.44
7.4.50.0040.00816.54
7.4.40.0070.01016.29
7.4.30.0140.00316.14
7.4.20.0080.00816.40
7.4.10.0080.00815.96
7.4.00.0080.00815.91
7.3.330.0000.00513.27
7.3.320.0030.00313.42
7.3.310.0070.00016.45
7.3.300.0030.00316.44
7.3.290.0030.01216.43
7.3.280.0060.00916.38
7.3.270.0090.00917.40
7.3.260.0090.00916.44
7.3.250.0110.00816.59
7.3.240.0030.01516.57
7.3.230.0000.01716.39
7.3.210.0140.00716.53
7.3.200.0070.01019.39
7.3.190.0150.00316.62
7.3.180.0130.00616.41
7.3.170.0090.00616.38
7.3.160.0060.00916.39
7.3.150.0080.00816.07
7.3.140.0040.01116.33
7.3.130.0140.00316.49
7.3.120.0120.00316.38
7.3.110.0110.00516.41
7.3.100.0120.00316.43
7.3.90.0040.01116.32
7.3.80.0060.00916.61
7.3.70.0060.00916.43
7.3.60.0090.00616.60
7.3.50.0120.00416.27
7.3.40.0110.00516.52
7.3.30.0140.00616.30
7.3.20.0080.00816.10
7.3.10.0070.01016.08
7.3.00.0160.01016.16
7.2.330.0100.00716.73
7.2.320.0100.01016.68
7.2.310.0100.00716.47
7.2.300.0110.00616.42
7.2.290.0100.00716.46
7.2.280.0080.00816.45
7.2.270.0080.00816.49
7.2.260.0070.01016.57
7.2.250.0120.00316.57
7.2.240.0060.00916.41
7.2.230.0000.01516.34
7.2.220.0120.00316.34
7.2.210.0080.00816.28
7.2.200.0060.00916.37
7.2.190.0000.01616.36
7.2.180.0090.00616.51
7.2.170.0090.00916.34
7.2.160.0110.00516.56
7.2.150.0140.00316.63
7.2.140.0100.00716.40
7.2.130.0030.01416.49
7.2.120.0110.00716.51
7.2.110.0060.01016.46
7.2.100.0020.01416.50
7.2.90.0070.00916.48
7.2.80.0110.00816.49
7.2.70.0090.00816.69
7.2.60.0080.00816.67
7.2.50.0110.00516.67
7.2.40.0130.00316.68
7.2.30.0050.01016.61
7.2.20.0110.00516.60
7.2.10.0090.00716.62
7.2.00.0040.01017.54
7.1.330.0120.00315.64
7.1.320.0130.00615.48
7.1.310.0030.01215.43
7.1.300.0050.01015.56
7.1.290.0110.00415.35
7.1.280.0060.01015.36
7.1.270.0060.01115.45
7.1.260.0050.01115.43
7.1.250.0090.00615.50
7.1.240.0090.00615.37
7.1.230.0030.01215.57
7.1.220.0080.00615.57
7.1.210.0060.01015.65
7.1.200.0060.00815.71
7.1.190.0080.00615.65
7.1.180.0080.00715.59
7.1.170.0070.00915.46
7.1.160.0050.00815.43
7.1.150.0060.00915.46
7.1.140.0020.01215.55
7.1.130.0090.00415.58
7.1.120.0100.00415.55
7.1.110.0040.01015.51
7.1.100.0070.00516.36
7.1.90.0100.00815.37
7.1.80.0090.00615.25
7.1.70.0050.00816.13
7.1.60.0100.01016.96
7.1.50.0100.01116.11
7.1.40.0130.00615.60
7.1.30.0120.00915.56
7.1.20.0110.01415.80
7.1.10.0110.01115.48
7.1.00.0100.03117.86
7.0.330.0040.01115.03
7.0.320.0110.00415.27
7.0.310.0060.00815.21
7.0.300.0020.01315.24
7.0.290.0090.00615.27
7.0.280.0050.00715.35
7.0.270.0100.00315.20
7.0.260.0030.01015.10
7.0.250.0060.00615.36
7.0.240.0090.00715.24
7.0.230.0130.00715.05
7.0.220.0110.00614.94
7.0.210.0100.00515.15
7.0.200.0100.00315.86
7.0.190.0110.00915.23
7.0.180.0070.00915.26
7.0.170.0110.00715.39
7.0.160.0160.00415.16
7.0.150.0140.00515.21
7.0.140.0080.02717.53
7.0.130.0140.00615.30
7.0.120.0020.01215.34
7.0.110.0080.00515.28
7.0.100.0050.01015.21
7.0.90.0060.00815.35
7.0.80.0090.00615.11
7.0.70.0080.00515.25
7.0.60.0100.02316.71
7.0.50.0070.02516.15
7.0.40.0070.02316.06
7.0.30.0140.03016.25
7.0.20.0110.02016.15
7.0.10.0150.03316.20
7.0.00.0050.02516.09
5.6.400.0030.01415.51
5.6.390.0090.00915.73
5.6.380.0070.00915.17
5.6.370.0060.00815.09
5.6.360.0100.00614.95
5.6.350.0100.00314.99
5.6.340.0110.00415.22
5.6.330.0050.01014.96
5.6.320.0050.00915.01
5.6.310.0140.00715.13
5.6.300.0110.01115.05
5.6.290.0120.01015.18
5.6.280.0110.02816.94
5.6.270.0090.00615.16
5.6.260.0060.01015.10
5.6.250.0070.01014.97
5.6.240.0070.00714.84
5.6.230.0060.01114.94
5.6.220.0090.00615.07
5.6.210.0070.03316.77
5.6.200.0070.02516.06
5.6.190.0050.02816.80
5.6.180.1340.01916.78
5.6.170.0170.02116.73
5.6.160.0080.03316.79
5.6.150.0060.02015.91
5.6.140.0090.02316.06
5.6.130.0080.03015.95
5.6.120.0080.02116.98
5.6.110.0120.02916.97
5.6.100.0080.03116.94
5.6.90.0100.02617.04
5.6.80.0080.03216.72
5.6.70.0090.03016.72
5.6.60.0120.00414.73
5.6.50.0090.00614.83
5.6.40.0100.00714.78
5.6.30.0050.01014.86
5.6.20.0060.00914.79
5.6.10.0040.01114.92
5.6.00.0090.00714.79
5.5.380.0060.00712.99
5.5.370.0020.01213.11
5.5.360.0040.01013.15
5.5.350.0090.03215.64
5.5.340.0150.02414.82
5.5.330.0080.02715.54
5.5.320.0090.02015.63
5.5.310.0140.02515.64
5.5.300.0070.02914.70
5.5.290.0020.02214.65
5.5.280.0020.03815.65
5.5.270.0100.03015.77
5.5.260.0020.03115.73
5.5.250.0160.02415.57
5.5.240.0070.01715.48
5.5.230.0090.00713.00
5.5.220.0100.00513.14
5.5.210.0050.00913.21
5.5.200.0020.01213.03
5.5.190.0060.00913.04
5.5.180.0050.00813.19
5.5.170.0070.01014.74
5.5.160.0070.00913.13
5.5.150.0030.01113.00
5.5.140.0050.00813.04
5.5.130.0060.00812.89
5.5.120.0030.01113.03
5.5.110.0040.00913.28
5.5.100.0040.00912.99
5.5.90.0100.00513.06
5.5.80.0110.00313.16
5.5.70.0050.01012.99
5.5.60.0070.00713.14
5.5.50.0080.00612.87
5.5.40.0060.00613.06
5.5.30.0040.01012.89
5.5.20.0020.01313.15
5.5.10.0050.00812.90
5.5.00.0060.00913.16
5.4.450.0820.01814.15
5.4.440.0850.01514.24
5.4.430.0920.01814.11
5.4.420.0780.01814.09
5.4.410.0050.01814.13
5.4.400.0060.01813.88
5.4.390.0390.02813.96
5.4.380.0850.01713.95
5.4.370.0870.01913.79
5.4.360.0870.01914.05
5.4.350.0880.01714.12
5.4.340.0880.01814.07
5.4.330.0080.00511.45
5.4.320.0760.01613.99
5.4.310.0900.01713.88
5.4.300.0880.01514.00
5.4.290.0850.01913.95
5.4.280.0900.01513.99
5.4.270.0820.01814.02
5.4.260.0830.01413.96
5.4.250.0810.01714.16
5.4.240.0840.01913.92
5.4.230.0800.01513.96
5.4.220.0800.01813.94
5.4.210.0800.01614.00
5.4.200.0570.01814.00
5.4.190.0030.02013.88
5.4.180.0020.02013.82
5.4.170.0490.01313.97
5.4.160.0710.01813.98
5.4.150.0950.01914.08
5.4.140.0760.01713.16
5.4.130.0840.01613.25
5.4.120.0690.01813.12
5.4.110.0730.01413.11
5.4.100.0910.01713.21
5.4.90.0800.01413.15
5.4.80.0530.01913.14
5.4.70.0050.01713.20
5.4.60.0010.01813.17
5.4.50.0090.01113.08
5.4.40.0460.01813.16
5.4.30.0720.01413.15
5.4.20.0740.01513.15
5.4.10.0830.01313.17
5.4.00.0710.01312.90
5.3.290.0760.01812.63
5.3.280.0800.01812.55
5.3.270.0860.01912.56
5.3.260.0880.01812.63
5.3.250.0790.01612.46
5.3.240.0870.01612.40
5.3.230.0810.01512.52
5.3.220.0870.01812.49
5.3.210.0880.01912.67
5.3.200.0870.01512.45
5.3.190.0840.01412.59
5.3.180.0760.01612.69
5.3.170.0840.01912.64
5.3.160.0740.01512.59
5.3.150.0840.01812.71
5.3.140.0800.01612.58
5.3.130.0790.01812.55
5.3.120.0780.01512.65
5.3.110.0890.01712.63
5.3.100.0840.01812.38
5.3.90.0870.02012.43
5.3.80.0840.02012.37
5.3.70.0900.01712.45
5.3.60.0910.01412.41
5.3.50.0890.01612.36
5.3.40.0850.02012.22
5.3.30.0770.01712.37
5.3.20.0870.02012.27
5.3.10.0860.01812.10
5.3.00.0850.01812.04
5.2.170.0740.01210.72
5.2.160.0730.01310.77
5.2.150.0620.01710.76
5.2.140.0770.01010.70
5.2.130.0670.01310.68
5.2.120.0640.01510.63
5.2.110.0710.01710.71
5.2.100.0700.01010.72
5.2.90.0640.00910.66
5.2.80.0720.01610.70
5.2.70.0760.01210.74
5.2.60.0740.01610.68
5.2.50.0730.01010.66
5.2.40.0510.01510.64
5.2.30.0610.01310.56
5.2.20.0520.01410.58
5.2.10.0590.01510.50
5.2.00.0600.01410.37
5.1.60.0620.0119.81
5.1.50.0600.0119.82
5.1.40.0540.0139.87
5.1.30.0570.01110.03
5.1.20.0580.01210.05
5.1.10.0590.0119.87
5.1.00.0590.0099.85
5.0.50.0290.0109.11
5.0.40.0270.0129.12
5.0.30.0280.0149.07
5.0.20.0340.0109.00
5.0.10.0330.0139.05
5.0.00.0300.0139.06
4.4.90.0360.0068.99
4.4.80.0310.0078.99
4.4.70.0340.0078.99
4.4.60.0280.0068.99
4.4.50.0280.0088.99
4.4.40.0320.0128.99
4.4.30.0290.0088.99
4.4.20.0330.0118.99
4.4.10.0270.0098.99
4.4.00.0280.0118.99
4.3.110.0350.0058.99
4.3.100.0290.0088.99
4.3.90.0310.0088.99
4.3.80.0320.0148.99
4.3.70.0260.0108.99
4.3.60.0350.0088.99
4.3.50.0300.0068.99
4.3.40.0320.0108.99
4.3.30.0140.0088.99
4.3.20.0140.0088.99
4.3.10.0120.0098.99
4.3.00.0140.0088.99

preferences:
32.04 ms | 400 KiB | 5 Q