3v4l.org

run code in 300+ PHP versions simultaneously
<?php function endswith($string, $test) { $strlen = strlen($string); $testlen = strlen($test); if ($testlen > $strlen) return false; return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; } if (version_compare(phpversion(), '5.1.0', '>=')) { var_dump(endswith("abcdefg", "abc")); var_dump(endswith("abcdefg", "efg")); }

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)
7.3.10.0070.00716.49
7.3.00.0040.01216.51
7.2.130.0000.01016.73
7.2.120.0040.01216.65
7.2.110.0120.00316.95
7.2.100.0090.00016.69
7.2.90.0070.00716.56
7.2.80.0070.01116.73
7.2.70.0080.00716.67
7.2.60.0030.00616.75
7.2.50.0070.00716.96
7.2.40.0080.00416.82
7.2.30.0000.01116.88
7.2.20.0040.00816.68
7.2.10.0070.00716.86
7.2.00.0050.00718.01
7.1.250.0040.01215.91
7.1.100.0080.00318.30
7.1.70.0040.00417.27
7.1.60.0110.01419.70
7.1.50.0160.00916.88
7.1.00.0070.07322.35
7.0.200.0050.00316.67
7.0.140.0030.07322.12
7.0.100.0100.03319.89
7.0.90.0070.04019.89
7.0.80.0070.04019.82
7.0.70.0070.07019.88
7.0.60.0000.09019.86
7.0.50.0070.08020.36
7.0.40.0100.04720.11
7.0.30.0100.08019.95
7.0.20.0130.07319.95
7.0.10.0100.08320.00
7.0.00.0100.07320.09
5.6.280.0030.07321.13
5.6.250.0070.04020.54
5.6.240.0070.04320.46
5.6.230.0100.03720.45
5.6.220.0100.07720.62
5.6.210.0070.07720.50
5.6.200.0100.07721.14
5.6.190.0070.04721.14
5.6.180.0170.07721.17
5.6.170.0100.08021.03
5.6.160.0030.08320.95
5.6.150.0030.08721.14
5.6.140.0000.09021.00
5.6.130.0130.07021.11
5.6.120.0130.07321.14
5.6.110.0070.06721.04
5.6.100.0070.05020.95
5.6.90.0030.08721.03
5.6.80.0230.06720.31
5.6.70.0130.06720.39
5.6.60.0000.07720.44
5.6.50.0030.08320.56
5.6.40.0130.05020.38
5.6.30.0070.08020.32
5.6.20.0070.05320.41
5.6.10.0130.07020.52
5.6.00.0130.06320.51
5.5.380.0000.04720.45
5.5.370.0000.04720.36
5.5.360.0030.08320.29
5.5.350.0130.07720.40
5.5.340.0070.08720.93
5.5.330.0030.09020.91
5.5.320.0030.08720.93
5.5.310.0070.05020.89
5.5.300.0170.06720.73
5.5.290.0130.07020.90
5.5.280.0130.07720.80
5.5.270.0100.04720.79
5.5.260.0070.07720.64
5.5.250.0130.07320.60
5.5.240.0030.08720.27
5.5.230.0030.06720.31
5.5.220.0170.04020.18
5.5.210.0070.05320.27
5.5.200.0100.08020.13
5.5.190.0030.05020.13
5.5.180.0070.08020.13
5.5.160.0200.06020.18
5.5.150.0170.05720.20
5.5.140.0130.07320.27
5.5.130.0130.05320.21
5.5.120.0130.06320.29
5.5.110.0070.03720.11
5.5.100.0100.08019.95
5.5.90.0070.04719.92
5.5.80.0170.05720.07
5.5.70.0130.04720.02
5.5.60.0000.08320.13
5.5.50.0100.07720.05
5.5.40.0100.07720.04
5.5.30.0070.04719.96
5.5.20.0070.08020.05
5.5.10.0100.05720.05
5.5.00.0130.07320.07
5.4.450.0100.08319.45
5.4.440.0030.07719.37
5.4.430.0070.08019.19
5.4.420.0030.04719.45
5.4.410.0100.06319.33
5.4.400.0070.04719.05
5.4.390.0070.07319.23
5.4.380.0130.06719.16
5.4.370.0030.04319.04
5.4.360.0130.07019.16
5.4.350.0100.07019.05
5.4.340.0100.05019.13
5.4.320.0100.06319.23
5.4.310.0130.06019.05
5.4.300.0070.08018.84
5.4.290.0070.07319.22
5.4.280.0000.08319.12
5.4.270.0000.04719.12
5.4.260.0100.07019.04
5.4.250.0170.06319.02
5.4.240.0070.06719.08
5.4.230.0070.04319.04
5.4.220.0100.07319.02
5.4.210.0100.07319.11
5.4.200.0170.07019.12
5.4.190.0000.05019.03
5.4.180.0100.03719.20
5.4.170.0130.07719.18
5.4.160.0070.07719.07
5.4.150.0070.04719.19
5.4.140.0030.03716.20
5.4.130.0100.07316.43
5.4.120.0030.04316.38
5.4.110.0030.06016.32
5.4.100.0170.06016.47
5.4.90.0030.05316.43
5.4.80.0070.05716.41
5.4.70.0070.07016.33
5.4.60.0100.07316.48
5.4.50.0130.06316.36
5.4.40.0100.06016.52
5.4.30.0070.08016.29
5.4.20.0000.06316.24
5.4.10.0100.07316.48
5.4.00.0100.07015.84
5.3.290.0100.07314.61
5.3.280.0070.08014.64
5.3.270.0000.05014.73
5.3.260.0030.04314.61
5.3.250.0130.07314.54
5.3.240.0200.06714.53
5.3.230.0070.06314.55
5.3.220.0070.07714.63
5.3.210.0070.07314.49
5.3.200.0070.07714.62
5.3.190.0030.08014.70
5.3.180.0070.07714.63
5.3.170.0000.04314.54
5.3.160.0070.05314.68
5.3.150.0070.07314.51
5.3.140.0030.07714.62
5.3.130.0130.08014.65
5.3.120.0130.07014.50
5.3.110.0130.07314.68
5.3.100.0100.06714.16
5.3.90.0070.06714.04
5.3.80.0130.06714.13
5.3.70.0070.07014.04
5.3.60.0000.08313.94
5.3.50.0030.07713.87
5.3.40.0070.07313.96
5.3.30.0070.06713.82
5.3.20.0270.06013.61
5.3.10.0130.06713.53
5.3.00.0070.03713.69
5.2.170.0100.06011.19
5.2.160.0070.06011.15
5.2.150.0070.03311.29
5.2.140.0000.05311.01
5.2.130.0030.04010.99
5.2.120.0030.04310.96
5.2.110.0030.04711.21
5.2.100.0000.05310.96
5.2.90.0070.06010.96
5.2.80.0070.06011.11
5.2.70.0070.05711.15
5.2.60.0000.06711.07
5.2.50.0070.03311.04
5.2.40.0000.04310.85
5.2.30.0100.04010.98
5.2.20.0130.05010.98
5.2.10.0070.05710.72
5.2.00.0070.05010.71
5.1.60.0030.05310.09
5.1.50.0070.05710.08
5.1.40.0030.04310.07
5.1.30.0000.04010.34
5.1.20.0030.05310.34
5.1.10.0030.0579.91
5.1.00.0000.0339.95
5.0.50.0000.0478.61
5.0.40.0130.0308.48
5.0.30.0030.0678.09
5.0.20.0030.0438.26
5.0.10.0030.0378.24
5.0.00.0030.0538.15
4.4.90.0000.0377.93
4.4.80.0030.0307.93
4.4.70.0030.0337.93
4.4.60.0030.0237.93
4.4.50.0030.0377.93
4.4.40.0000.0537.93
4.4.30.0030.0377.93
4.4.20.0000.0377.93
4.4.10.0030.0337.93
4.4.00.0000.0577.93
4.3.110.0000.0377.93
4.3.100.0000.0337.93
4.3.90.0000.0377.93
4.3.80.0070.0477.93
4.3.70.0000.0277.93
4.3.60.0000.0377.93
4.3.50.0000.0207.93
4.3.40.0070.0437.93
4.3.30.0000.0377.93
4.3.20.0030.0337.93
4.3.10.0000.0407.93
4.3.00.0000.0377.93

preferences:
32.27 ms | 400 KiB | 5 Q