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 = func_get_args(); 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.0100.00718.18
8.3.50.0130.00522.99
8.3.40.0110.01118.71
8.3.30.0040.01118.92
8.3.20.0070.00020.33
8.3.10.0050.00223.48
8.3.00.0080.00019.13
8.2.180.0180.00416.38
8.2.170.0040.01122.96
8.2.160.0060.00920.52
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0050.00521.16
8.2.110.0090.00021.03
8.2.100.0060.00617.72
8.2.90.0030.00519.05
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0080.00017.79
8.2.50.0000.01018.07
8.2.40.0000.00818.28
8.2.30.0040.00418.14
8.2.20.0000.00817.63
8.2.10.0050.00218.10
8.2.00.0040.00417.63
8.1.280.0110.01125.92
8.1.270.0080.00023.85
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.02
8.1.230.0090.00319.01
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.38
8.1.190.0080.00017.13
8.1.180.0030.00518.10
8.1.170.0080.00018.66
8.1.160.0050.00222.05
8.1.150.0000.00818.91
8.1.140.0000.00717.38
8.1.130.0000.00717.73
8.1.120.0000.00717.56
8.1.110.0000.00717.54
8.1.100.0020.00517.48
8.1.90.0040.00417.48
8.1.80.0070.00017.49
8.1.70.0030.00317.39
8.1.60.0080.00017.59
8.1.50.0040.00417.58
8.1.40.0070.00017.42
8.1.30.0000.00817.69
8.1.20.0030.00517.71
8.1.10.0090.00017.54
8.1.00.0080.00017.49
8.0.300.0040.00418.77
8.0.290.0050.00316.63
8.0.280.0030.00318.48
8.0.270.0000.00717.21
8.0.260.0000.00617.25
8.0.250.0030.00317.00
8.0.240.0000.00716.86
8.0.230.0070.00016.88
8.0.220.0030.00316.95
8.0.210.0030.00316.91
8.0.200.0000.00616.88
8.0.190.0030.00516.88
8.0.180.0040.00316.93
8.0.170.0080.00017.02
8.0.160.0050.00216.86
8.0.150.0000.00816.83
8.0.140.0040.00416.72
8.0.130.0050.00013.37
8.0.120.0070.00016.88
8.0.110.0000.00716.92
8.0.100.0040.00416.94
8.0.90.0030.00616.76
8.0.80.0190.00316.96
8.0.70.0070.00017.00
8.0.60.0070.00016.92
8.0.50.0000.00816.87
8.0.30.0070.01217.17
8.0.20.0050.01517.40
8.0.10.0040.00417.00
8.0.00.0120.00716.75
7.4.330.0030.00315.09
7.4.320.0000.00716.54
7.4.300.0000.00816.64
7.4.290.0030.00316.39
7.4.280.0000.00716.43
7.4.270.0070.00016.53
7.4.260.0000.00916.52
7.4.250.0000.00716.52
7.4.240.0020.00616.54
7.4.230.0040.00416.62
7.4.220.0030.01316.52
7.4.210.0110.00416.66
7.4.200.0000.00716.52
7.4.160.0100.00716.45
7.4.150.0070.02017.40
7.4.140.0070.01017.86
7.4.130.0090.00816.50
7.4.120.0160.00316.50
7.4.110.0090.00916.38
7.4.100.0080.01016.55
7.4.90.0140.00316.41
7.4.80.0120.00619.39
7.4.70.0030.01616.46
7.4.60.0070.00916.58
7.4.50.0080.00616.54
7.4.40.0100.00716.46
7.4.30.0070.01016.50
7.4.20.0120.00916.27
7.4.10.0130.00716.45
7.4.00.0070.01116.02
7.3.330.0060.00013.42
7.3.320.0000.00613.42
7.3.310.0000.00716.45
7.3.300.0000.00716.25
7.3.290.0000.01516.43
7.3.280.0100.00816.48
7.3.270.0090.01517.40
7.3.260.0120.00616.39
7.3.250.0180.00216.56
7.3.240.0130.01016.66
7.3.230.0090.00916.61
7.3.210.0120.00616.39
7.3.200.0130.00319.39
7.3.190.0060.01516.38
7.3.180.0080.01016.51
7.3.170.0030.01516.41
7.3.160.0120.01216.26
7.3.150.0100.01016.35
7.3.140.0130.00616.67
7.3.130.0090.01216.34
7.3.120.0120.00416.60
7.3.110.0100.00616.50
7.3.100.0110.00516.62
7.3.90.0060.00916.41
7.3.80.0030.01316.67
7.3.70.0050.01016.45
7.3.60.0030.01816.34
7.3.50.0080.00816.32
7.3.40.0100.00716.48
7.3.30.0100.00616.61
7.3.20.0090.00916.45
7.3.10.0120.00516.48
7.3.00.0090.00616.30
7.2.330.0110.01416.85
7.2.320.0070.01016.44
7.2.310.0120.00616.56
7.2.300.0120.00416.63
7.2.290.0070.01016.62
7.2.280.0140.00416.68
7.2.270.0070.01416.48
7.2.260.0150.00616.71
7.2.250.0090.00716.57
7.2.240.0050.01316.79
7.2.230.0090.00916.77
7.2.220.0080.00816.72
7.2.210.0100.00716.58
7.2.200.0110.00616.65
7.2.190.0070.01016.60
7.2.180.0030.01316.50
7.2.170.0090.00916.62
7.2.160.0070.01116.61
7.2.150.0150.00416.81
7.2.140.0090.00916.63
7.2.130.0130.00516.66
7.2.120.0080.00916.62
7.2.110.0120.00616.77
7.2.100.0070.00716.82
7.2.90.0050.01216.94
7.2.80.0100.00616.70
7.2.70.0090.00616.75
7.2.60.0060.01016.85
7.2.50.0110.00716.79
7.2.40.0060.01316.84
7.2.30.0080.01116.86
7.2.20.0120.00816.83
7.2.10.0100.01116.82
7.2.00.0110.00816.92
7.1.330.0040.01515.46
7.1.320.0120.00615.39
7.1.310.0110.00715.47
7.1.300.0110.00715.38
7.1.290.0040.01615.31
7.1.280.0110.00715.41
7.1.270.0130.01315.47
7.1.260.0080.01015.34
7.1.250.0140.00615.70
7.1.240.0070.00915.56
7.1.230.0080.00715.42
7.1.220.0100.00615.50
7.1.210.0170.00315.58
7.1.200.0100.00815.41
7.1.190.0130.00815.65
7.1.180.0160.00515.47
7.1.170.0140.00815.54
7.1.160.0160.00615.49
7.1.150.0080.01215.42
7.1.140.0100.01415.64
7.1.130.0110.01215.44
7.1.120.0130.01015.57
7.1.110.0120.00915.47
7.1.100.0100.01115.66
7.1.90.0100.01115.41
7.1.80.0120.00915.46
7.1.70.0060.01216.02
7.1.60.0090.00816.88
7.1.50.0120.00816.00
7.1.40.0050.01115.46
7.1.30.0110.00715.67
7.1.20.0060.01415.53
7.1.10.0130.00715.54
7.1.00.0120.03117.79
7.0.330.0160.00214.89
7.0.320.0090.01015.11
7.0.310.0130.00514.98
7.0.300.0140.00715.04
7.0.290.0110.00615.33
7.0.280.0110.00915.17
7.0.270.0120.01114.87
7.0.260.0140.00715.18
7.0.250.0120.00715.04
7.0.240.0120.00715.14
7.0.230.0120.00815.11
7.0.220.0110.00915.23
7.0.210.0120.00715.19
7.0.200.0070.00715.73
7.0.190.0160.00315.23
7.0.180.0080.00815.28
7.0.170.0080.01115.30
7.0.160.0110.00515.14
7.0.150.0120.00815.20
7.0.140.0100.02517.44
7.0.130.0090.00815.16
7.0.120.0070.01015.18
7.0.110.0050.01115.34
7.0.100.0100.00715.18
7.0.90.0080.00715.19
7.0.80.0110.00615.20
7.0.70.0140.00715.13
7.0.60.0090.01716.84
7.0.50.0090.01916.11
7.0.40.0110.03116.25
7.0.30.0130.03516.14
7.0.20.0100.01816.10
7.0.10.0090.03316.20
7.0.00.0060.03816.21
5.6.400.0100.00915.57
5.6.390.0160.00415.71
5.6.380.0070.01414.94
5.6.370.0090.00915.04
5.6.360.0110.00614.91
5.6.350.0080.01114.95
5.6.340.0100.00815.11
5.6.330.0120.00714.88
5.6.320.0100.00715.14
5.6.310.0090.00814.93
5.6.300.0110.00815.09
5.6.290.0130.00614.94
5.6.280.0050.03016.95
5.6.270.0080.00915.04
5.6.260.0060.01114.88
5.6.250.0040.01214.90
5.6.240.0050.01014.83
5.6.230.0080.01214.88
5.6.220.0150.00814.84
5.6.210.0060.03416.70
5.6.200.0080.02315.87
5.6.190.0070.03216.71
5.6.180.0130.02316.64
5.6.170.0160.02616.84
5.6.160.0090.02216.79
5.6.150.0070.03315.93
5.6.140.0080.02016.19
5.6.130.0080.02015.99
5.6.120.0080.02017.05
5.6.110.0040.03617.01
5.6.100.0100.01416.97
5.6.90.0110.02716.94
5.6.80.0070.03216.65
5.6.70.0110.00614.93
5.6.60.0040.01114.89
5.6.50.0060.01114.75
5.6.40.0060.01014.75
5.6.30.0110.00614.82
5.6.20.0050.01314.82
5.6.10.0040.01414.77
5.6.00.0090.00814.74
5.5.380.0040.01213.21
5.5.370.0060.01113.52
5.5.360.0080.00913.29
5.5.350.0190.02915.66
5.5.340.0070.01814.75
5.5.330.0060.02015.63
5.5.320.0160.02215.63
5.5.310.0220.02215.66
5.5.300.0060.02414.97
5.5.290.0070.01814.88
5.5.280.0090.03415.75
5.5.270.0100.02615.67
5.5.260.0090.03015.78
5.5.250.0090.02215.70
5.5.240.0060.03215.60
5.5.230.0060.00613.42
5.5.220.0060.01013.22
5.5.210.0060.01113.36
5.5.200.0120.00213.20
5.5.190.0100.00713.27
5.5.180.0050.01313.32
5.5.170.0070.00913.27
5.5.160.0110.00413.24
5.5.150.0090.00813.13
5.5.140.0090.00813.19
5.5.130.0120.00613.43
5.5.120.0070.00913.22
5.5.110.0070.00813.11
5.5.100.0050.01213.17
5.5.90.0090.00913.13
5.5.80.0080.00713.34
5.5.70.0080.00813.15
5.5.60.0070.00913.30
5.5.50.0020.01113.17
5.5.40.0060.01013.25
5.5.30.0090.00713.47
5.5.20.0070.00713.05
5.5.10.0100.01013.09
5.5.00.0110.00713.29
5.4.450.0090.01914.31
5.4.440.0160.01514.36
5.4.430.0140.01614.35
5.4.420.0090.01714.35
5.4.410.0100.01814.33
5.4.400.0100.01714.24
5.4.390.0100.01914.15
5.4.380.0130.02414.10
5.4.370.0130.02413.98
5.4.360.0150.02213.95
5.4.350.0120.02714.02
5.4.340.0160.02214.02
5.4.330.0060.00911.64
5.4.320.0050.01811.96
5.4.310.0080.01812.02
5.4.300.0070.01612.04
5.4.290.0060.01512.07
5.4.280.0060.01611.96
5.4.270.0040.01711.95
5.4.260.0070.01811.80
5.4.250.0040.01911.82
5.4.240.0070.01611.87
5.4.230.0070.01811.91
5.4.220.0060.01611.96
5.4.210.0040.01711.98
5.4.200.0030.01811.98
5.4.190.0050.01811.93
5.4.180.0060.01712.00
5.4.170.0070.01611.98
5.4.160.0070.01611.94
5.4.150.0070.01912.06
5.4.140.0060.01811.90
5.4.130.0050.01911.81
5.4.120.0080.01711.72
5.4.110.0070.01611.81
5.4.100.0080.01711.83
5.4.90.0080.01911.72
5.4.80.0090.01511.89
5.4.70.0070.01411.77
5.4.60.0090.01511.84
5.4.50.0050.01611.79
5.4.40.0090.01411.87
5.4.30.0060.01911.84
5.4.20.0060.01711.90
5.4.10.0080.01411.84
5.4.00.0100.01611.68
5.3.290.0050.02312.26
5.3.280.0070.01612.06
5.3.270.0100.01212.12
5.3.260.0050.02012.08
5.3.250.0070.01812.17
5.3.240.0090.01612.04
5.3.230.0060.01912.03
5.3.220.0080.01712.00
5.3.210.0070.01812.04
5.3.200.0080.01611.97
5.3.190.0040.01911.96
5.3.180.0090.01512.19
5.3.170.0050.01712.05
5.3.160.0060.01812.07
5.3.150.0050.02012.15
5.3.140.0080.01512.05
5.3.130.0090.02112.03
5.3.120.0090.01712.08
5.3.110.0050.02012.14
5.3.100.0100.01511.92
5.3.90.0080.01511.82
5.3.80.0060.01711.88
5.3.70.0060.01911.84
5.3.60.0080.01511.80
5.3.50.0060.01711.84
5.3.40.0070.01711.85
5.3.30.0060.01711.79
5.3.20.0020.02111.82
5.3.10.0040.01811.56
5.3.00.0070.01811.65
5.2.170.0050.01610.42
5.2.160.0070.01310.40
5.2.150.0080.01210.44
5.2.140.0070.01510.43
5.2.130.0070.01510.34
5.2.120.0020.01910.42
5.2.110.0070.01210.41
5.2.100.0060.01210.36
5.2.90.0070.01210.35
5.2.80.0060.01210.37
5.2.70.0060.01410.37
5.2.60.0030.01410.29
5.2.50.0070.01310.29
5.2.40.0060.01310.31
5.2.30.0060.01410.33
5.2.20.0070.01110.30
5.2.10.0050.01410.19
5.2.00.0040.01510.12
5.1.60.0040.0129.65
5.1.50.0050.0129.66
5.1.40.0020.0149.69
5.1.30.0040.0139.84
5.1.20.0030.0139.81
5.1.10.0020.0169.74
5.1.00.0070.0099.66
5.0.50.0030.0108.96
5.0.40.0050.0088.86
5.0.30.0020.0168.80
5.0.20.0030.0108.80
5.0.10.0030.0098.79
5.0.00.0030.0138.79
4.4.90.0040.0078.28
4.4.80.0040.0068.27
4.4.70.0020.0078.27
4.4.60.0040.0078.27
4.4.50.0050.0058.28
4.4.40.0040.0098.26
4.4.30.0030.0078.28
4.4.20.0050.0048.30
4.4.10.0020.0088.30
4.4.00.0030.0098.27
4.3.110.0020.0088.24
4.3.100.0050.0058.24
4.3.90.0040.0068.23
4.3.80.0030.0108.22
4.3.70.0040.0058.23
4.3.60.0020.0078.23
4.3.50.0040.0058.23
4.3.40.0020.0118.20
4.3.30.0050.0067.81
4.3.20.0040.0067.80
4.3.10.0010.0097.78
4.3.00.0030.00712.83

preferences:
42.91 ms | 401 KiB | 5 Q