3v4l.org

run code in 300+ PHP versions simultaneously
<?php say("strcmp(): Returns < 0 if str1 is less than str2;", " > 0 if str1 is greater than str2, and 0 if they are equal.", " 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)) { 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.0170.00318.21
8.3.50.0040.01122.78
8.3.40.0110.00418.67
8.3.30.0080.00619.04
8.3.20.0040.00420.22
8.3.10.0070.00023.61
8.3.00.0080.00019.25
8.2.180.0090.00616.63
8.2.170.0120.00622.96
8.2.160.0040.01120.28
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00421.09
8.2.110.0070.00322.05
8.2.100.0000.01218.16
8.2.90.0000.00819.28
8.2.80.0080.00017.97
8.2.70.0080.00517.38
8.2.60.0080.00017.80
8.2.50.0030.00618.07
8.2.40.0000.00918.03
8.2.30.0040.00417.89
8.2.20.0000.00817.52
8.2.10.0040.00417.95
8.2.00.0000.00717.60
8.1.280.0120.00625.92
8.1.270.0060.00323.70
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00623.82
8.1.230.0040.00719.11
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0070.00317.11
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0000.00818.59
8.1.160.0050.00222.09
8.1.150.0000.00718.85
8.1.140.0040.00417.42
8.1.130.0030.00317.82
8.1.120.0070.00017.31
8.1.110.0040.00417.31
8.1.100.0050.00317.31
8.1.90.0000.00817.45
8.1.80.0030.00617.28
8.1.70.0030.00317.34
8.1.60.0000.01017.60
8.1.50.0040.00417.33
8.1.40.0000.00817.35
8.1.30.0000.00817.52
8.1.20.0000.00717.45
8.1.10.0070.00017.54
8.1.00.0060.00317.43
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0030.00318.40
8.0.270.0070.00017.15
8.0.260.0040.00417.25
8.0.250.0000.00716.95
8.0.240.0000.00816.87
8.0.230.0030.00316.94
8.0.220.0000.00716.94
8.0.210.0030.00316.96
8.0.200.0030.00517.04
8.0.190.0000.00716.98
8.0.180.0030.00316.93
8.0.170.0080.00016.92
8.0.160.0000.00716.93
8.0.150.0080.00016.78
8.0.140.0020.00516.78
8.0.130.0000.00513.42
8.0.120.0050.00316.75
8.0.110.0040.00416.91
8.0.100.0040.00416.93
8.0.90.0060.00316.76
8.0.80.0000.01716.90
8.0.70.0070.00016.75
8.0.60.0040.00416.81
8.0.50.0000.00716.77
8.0.30.0100.01217.18
8.0.20.0140.00617.40
8.0.10.0000.00717.10
8.0.00.0120.00616.81
7.4.330.0020.00215.03
7.4.320.0030.00316.63
7.4.300.0060.00016.53
7.4.290.0000.00716.45
7.4.280.0030.00516.51
7.4.270.0000.00716.51
7.4.260.0050.00516.51
7.4.250.0040.00416.49
7.4.240.0040.00416.52
7.4.230.0050.00216.39
7.4.220.0110.00916.56
7.4.210.0000.01416.60
7.4.200.0000.00716.41
7.4.160.0100.00716.63
7.4.150.0130.00717.40
7.4.140.0180.00417.86
7.4.130.0110.00716.63
7.4.120.0100.00716.50
7.4.110.0030.01316.59
7.4.100.0110.00716.55
7.4.90.0090.00916.50
7.4.80.0120.00619.39
7.4.70.0120.00616.59
7.4.60.0100.00816.40
7.4.50.0060.00916.29
7.4.40.0030.01316.16
7.4.30.0040.01216.03
7.4.20.0100.00716.10
7.4.10.0110.00516.27
7.4.00.0070.00915.55
7.3.330.0060.00013.39
7.3.320.0050.00013.16
7.3.310.0030.00316.39
7.3.300.0040.00416.41
7.3.290.0100.00616.33
7.3.280.0110.01016.36
7.3.270.0100.01417.40
7.3.260.0120.00616.36
7.3.250.0050.01316.63
7.3.240.0110.00616.45
7.3.230.0080.01216.39
7.3.210.0230.01416.59
7.3.200.0120.01219.39
7.3.190.0110.01116.66
7.3.180.0070.00916.48
7.3.170.0060.00916.26
7.3.160.0060.00916.19
7.3.150.0080.00716.25
7.3.140.0030.01316.41
7.3.130.0090.00616.31
7.3.120.0080.00815.24
7.3.110.0060.01115.17
7.3.100.0080.00715.28
7.3.90.0050.00815.36
7.3.80.0070.00615.09
7.3.70.0060.00815.19
7.3.60.0040.01015.24
7.3.50.0060.00915.27
7.3.40.0060.00915.22
7.3.30.0060.00815.20
7.3.20.0050.01016.61
7.3.10.0080.00716.60
7.3.00.0100.00816.56
7.2.330.0070.01116.72
7.2.320.0060.01216.72
7.2.310.0120.00616.44
7.2.300.0100.00616.48
7.2.290.0100.00716.73
7.2.280.0030.01416.54
7.2.270.0100.00616.46
7.2.260.0060.00916.64
7.2.250.0080.00915.52
7.2.240.0070.00915.48
7.2.230.0080.00815.41
7.2.220.0070.00815.39
7.2.210.0070.00715.25
7.2.200.0080.00615.31
7.2.190.0040.01115.40
7.2.180.0040.00915.41
7.2.170.0060.00915.44
7.2.160.0090.00515.80
7.2.150.0090.00716.71
7.2.140.0020.01516.60
7.2.130.0030.01116.55
7.2.120.0060.01016.60
7.2.110.0070.01016.73
7.2.100.0160.00616.59
7.2.90.0090.00716.68
7.2.80.0050.01016.59
7.2.70.0050.01116.74
7.2.60.0060.00916.62
7.2.50.0060.01116.66
7.2.40.0070.00716.74
7.2.30.0070.00916.68
7.2.20.0080.00816.73
7.2.10.0120.00316.74
7.2.00.0110.00417.65
7.1.330.0050.00915.72
7.1.320.0050.00815.73
7.1.310.0060.01015.70
7.1.300.0080.00815.66
7.1.290.0050.00915.67
7.1.280.0070.00915.72
7.1.270.0050.00915.66
7.1.260.0050.01015.72
7.1.250.0050.01115.56
7.1.240.0090.00615.42
7.1.230.0090.00615.49
7.1.220.0160.00715.46
7.1.210.0090.00615.29
7.1.200.0020.01215.73
7.1.190.0100.01015.38
7.1.180.0130.00615.26
7.1.170.0060.01315.28
7.1.160.0070.00715.46
7.1.150.0110.00515.29
7.1.140.0100.00515.39
7.1.130.0000.01615.43
7.1.120.0100.01015.47
7.1.110.0090.01215.41
7.1.100.0080.00916.93
7.1.90.0120.00315.36
7.1.80.0060.01015.52
7.1.70.0060.00916.09
7.1.60.0140.00517.46
7.1.50.0090.01016.08
7.1.40.0110.00415.49
7.1.30.0030.01215.61
7.1.20.0060.01015.61
7.1.10.0110.00615.22
7.1.00.0050.04318.89
7.0.330.0080.00815.13
7.0.320.0130.00315.20
7.0.310.0070.00714.94
7.0.300.0450.00315.01
7.0.290.0160.00615.15
7.0.280.0070.00715.31
7.0.270.0070.00715.20
7.0.260.0070.01315.26
7.0.250.0080.00814.96
7.0.240.0070.00715.11
7.0.230.0070.00714.87
7.0.220.0070.01114.95
7.0.210.0140.00015.10
7.0.200.0030.00916.08
7.0.190.0090.00615.14
7.0.180.0150.00015.00
7.0.170.0090.00615.10
7.0.160.0080.00815.13
7.0.150.0110.00415.13
7.0.140.0060.04018.67
7.0.130.0080.00815.23
7.0.120.0090.00915.16
7.0.110.0100.01415.02
7.0.100.0100.00715.06
7.0.90.0060.01015.13
7.0.80.0130.00815.13
7.0.70.0050.01015.23
7.0.60.0100.04517.47
7.0.50.0090.02616.50
7.0.40.0140.04517.61
7.0.30.0200.02417.64
7.0.20.0260.03517.64
7.0.10.0090.04917.64
7.0.00.0110.03617.66
5.6.400.0090.00915.68
5.6.390.0040.01315.41
5.6.380.0140.00315.90
5.6.370.0130.01015.96
5.6.360.0090.01215.64
5.6.350.0110.00615.96
5.6.340.0140.00516.05
5.6.330.0160.00615.73
5.6.320.0040.01315.64
5.6.310.0030.01415.98
5.6.300.0070.01115.88
5.6.290.0130.00515.90
5.6.280.0030.04418.40
5.6.270.0100.01015.80
5.6.260.0040.01415.55
5.6.250.0090.00915.82
5.6.240.0090.00915.46
5.6.230.0090.00915.72
5.6.220.0130.00815.76
5.6.210.0070.02418.16
5.6.200.0080.02516.80
5.6.190.0090.04918.10
5.6.180.0140.02718.22
5.6.170.0180.04218.07
5.6.160.0100.04718.14
5.6.150.0120.04416.99
5.6.140.0070.03116.99
5.6.130.0100.04516.81
5.6.120.0140.05118.32
5.6.110.0100.04518.36
5.6.100.0110.03018.32
5.6.90.0080.02518.30
5.6.80.0100.04217.96
5.6.70.0150.00515.98
5.6.60.0150.00415.60
5.6.50.0090.01015.72
5.6.40.0000.01615.50
5.6.30.0080.00815.62
5.6.20.0110.00715.65
5.6.10.0130.00315.60
5.6.00.0120.00615.67
5.5.380.0000.01715.48
5.5.370.0110.00715.38
5.5.360.0110.01215.32
5.5.350.0240.03417.88
5.5.340.0070.02716.62
5.5.330.0080.04517.83
5.5.320.0150.03417.87
5.5.310.0220.02917.81
5.5.300.0050.02716.74
5.5.290.0040.04416.64
5.5.280.0100.03918.16
5.5.270.0100.03818.16
5.5.260.0150.04018.17
5.5.250.0070.02518.03
5.5.240.0100.03717.74
5.5.230.0110.00815.08
5.5.220.0160.00315.38
5.5.210.0030.01515.58
5.5.200.0070.01015.44
5.5.190.0060.01015.21
5.5.180.0070.01015.39
5.5.170.0160.00015.21
5.5.160.0140.00415.11
5.5.150.0030.01415.29
5.5.140.0060.01515.45
5.5.130.0070.01415.46
5.5.120.0030.01415.43
5.5.110.0060.01515.43
5.5.100.0160.00615.27
5.5.90.0070.01115.45
5.5.80.0100.00715.51
5.5.70.0140.00315.39
5.5.60.0000.01815.43
5.5.50.0110.00715.56
5.5.40.0030.01315.31
5.5.30.0120.00415.43
5.5.20.0070.01015.28
5.5.10.0130.00615.39
5.5.00.0100.01015.31
5.4.450.0120.02315.80
5.4.440.0170.02415.92
5.4.430.0070.03715.84
5.4.420.0080.03215.65
5.4.410.0160.02815.79
5.4.400.0130.02215.42
5.4.390.0140.04915.63
5.4.380.0210.03115.58
5.4.370.0260.02915.48
5.4.360.0300.03215.46
5.4.350.0230.03315.35
5.4.340.0260.02815.52
5.4.330.0070.00712.26
5.4.320.0060.02112.43
5.4.310.0030.02512.35
5.4.300.0070.02112.36
5.4.290.0070.02212.41
5.4.280.0080.02012.41
5.4.270.0050.02312.36
5.4.260.0030.02612.37
5.4.250.0070.02112.30
5.4.240.0060.02112.24
5.4.230.0080.02012.35
5.4.220.0040.02312.29
5.4.210.0040.02212.31
5.4.200.0040.02312.29
5.4.190.0050.02112.27
5.4.180.0030.02412.28
5.4.170.0080.02012.28
5.4.160.0030.02512.29
5.4.150.0040.02312.38
5.4.140.0070.02212.21
5.4.130.0060.02212.16
5.4.120.0080.01912.13
5.4.110.0110.01812.28
5.4.100.0020.02412.15
5.4.90.0060.02212.19
5.4.80.0050.02212.10
5.4.70.0050.02112.21
5.4.60.0050.02112.15
5.4.50.0070.01912.15
5.4.40.0060.02012.16
5.4.30.0050.02212.14
5.4.20.0030.02512.14
5.4.10.0020.02412.13
5.4.00.0050.02211.89
5.3.290.0060.02212.81
5.3.280.0060.02612.70
5.3.270.0050.02512.79
5.3.260.0060.02512.79
5.3.250.0020.02712.79
5.3.240.0060.02612.73
5.3.230.0070.02412.84
5.3.220.0060.02312.77
5.3.210.0050.02512.69
5.3.200.0070.02112.74
5.3.190.0100.01912.73
5.3.180.0080.02112.77
5.3.170.0040.02412.84
5.3.160.0040.02312.74
5.3.150.0070.02312.84
5.3.140.0040.02412.78
5.3.130.0050.02412.70
5.3.120.0060.02812.72
5.3.110.0020.02712.87
5.3.100.0020.02612.44
5.3.90.0040.02412.56
5.3.80.0040.02412.49
5.3.70.0060.02112.49
5.3.60.0080.02312.51
5.3.50.0080.02212.37
5.3.40.0050.02412.38
5.3.30.0070.02012.48
5.3.20.0060.02112.28
5.3.10.0050.02212.13
5.3.00.0060.02112.15
5.2.170.0040.02010.58
5.2.160.0070.01510.52
5.2.150.0060.02110.52
5.2.140.0050.01910.51
5.2.130.0050.02010.54
5.2.120.0050.02010.46
5.2.110.0080.02010.53
5.2.100.0050.01810.54
5.2.90.0080.01710.48
5.2.80.0050.01910.51
5.2.70.0020.02210.59
5.2.60.0040.02110.52
5.2.50.0040.02010.43
5.2.40.0030.02010.43
5.2.30.0030.02210.43
5.2.20.0030.02010.29
5.2.10.0050.01710.21
5.2.00.0040.01810.20
5.1.60.0040.0159.46
5.1.50.0020.0179.45
5.1.40.0020.0209.50
5.1.30.0050.0189.80
5.1.20.0030.0219.73
5.1.10.0040.0199.65
5.1.00.0070.0149.49
5.0.50.0030.0148.40
5.0.40.0030.0158.33
5.0.30.0010.0228.23
5.0.20.0060.0148.22
5.0.10.0040.0148.21
5.0.00.0030.0218.21
4.4.90.0050.0097.46
4.4.80.0050.0077.45
4.4.70.0020.0117.45
4.4.60.0040.0077.45
4.4.50.0040.0087.46
4.4.40.0030.0137.42
4.4.30.0020.0117.45
4.4.20.0040.0097.49
4.4.10.0030.0107.49
4.4.00.0050.0167.45
4.3.110.0010.0127.40
4.3.100.0040.0087.40
4.3.90.0020.0097.39
4.3.80.0030.0157.36
4.3.70.0020.0107.38
4.3.60.0020.0097.38
4.3.50.0030.0087.38
4.3.40.0020.0137.34
4.3.30.0040.0076.73
4.3.20.0010.0116.72
4.3.10.0010.0106.70
4.3.00.0050.00814.28

preferences:
47.18 ms | 401 KiB | 5 Q