3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startswith($haystack, $needle) { if (strlen($needle) > strlen($haystack)) { return false; } return substr($haystack, 0, strlen($needle)) === $needle; } function endswith($haystack, $needle) { if (strlen($needle) > strlen($haystack)) { return false; } $length = strlen($needle); return substr($haystack, -($length), $length) === $needle; } echo startswith('bla', 'bl') ? 'bla starts with bl' : 'bla does not start with bl'; echo PHP_EOL; echo endswith('bla', 'la') ? 'bla ends with la' : 'bla does not end with la'; echo PHP_EOL; echo endswith('bloop', 'la') ? 'bloop ends with la' : 'bloop does not end with la'; echo PHP_EOL; echo endswith('bloop', 'blablalba') ? 'bloop ends with blablalba' : 'bloop does not end with blablalba';

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.4.120.0080.00124.23
8.4.110.0120.00822.44
8.4.100.0080.00717.72
8.4.90.0070.00222.55
8.4.80.0150.00519.37
8.4.70.0110.00718.02
8.4.60.0100.00718.81
8.4.50.0120.00820.18
8.4.40.0080.00319.11
8.4.30.0080.00019.43
8.4.20.0130.00620.28
8.4.10.0070.00317.52
8.3.250.0130.00619.07
8.3.240.0050.00316.80
8.3.230.0130.00616.39
8.3.220.0140.00318.73
8.3.210.0130.00618.37
8.3.200.0050.00416.64
8.3.190.0110.00716.93
8.3.180.0100.00916.46
8.3.170.0120.00617.20
8.3.160.0070.01120.00
8.3.150.0120.00619.17
8.3.140.0050.00316.90
8.3.130.0060.00318.39
8.3.120.0060.00320.65
8.3.110.0120.00020.94
8.3.100.0060.00324.06
8.3.90.0110.00726.77
8.3.80.0060.00318.18
8.3.70.0140.00718.20
8.3.60.0070.00718.55
8.3.50.0120.00921.15
8.3.40.0110.00318.71
8.3.30.0060.00918.76
8.3.20.0000.00819.20
8.3.10.0070.00021.73
8.3.00.0030.00520.93
8.2.290.0070.01120.64
8.2.280.0110.00818.49
8.2.270.0110.00717.00
8.2.260.0160.00317.34
8.2.250.0040.01116.41
8.2.240.0070.00317.25
8.2.230.0000.00822.58
8.2.220.0050.00337.54
8.2.210.0050.00326.77
8.2.200.0030.00618.54
8.2.190.0180.00016.63
8.2.180.0140.00718.16
8.2.170.0120.00322.96
8.2.160.0080.00818.91
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00022.32
8.2.120.0060.00326.35
8.2.110.0030.00620.43
8.2.100.0070.01017.59
8.2.90.0000.00919.05
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0030.00517.80
8.2.50.0040.00418.10
8.2.40.0040.00420.61
8.2.30.0000.00819.33
8.2.20.0050.00318.16
8.2.10.0000.00718.15
8.2.00.0040.00417.70
8.1.330.0100.00821.87
8.1.320.0130.00716.04
8.1.310.0140.00018.69
8.1.300.0030.00618.00
8.1.290.0030.00630.84
8.1.280.0070.00725.92
8.1.270.0040.00423.98
8.1.260.0130.00626.35
8.1.250.0080.00028.09
8.1.240.0040.00423.97
8.1.230.0070.00417.75
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0000.00917.35
8.1.190.0000.00817.23
8.1.180.0050.00218.10
8.1.170.0000.00818.79
8.1.160.0050.00318.85
8.1.150.0000.00720.29
8.1.140.0080.00019.58
8.1.130.0000.00817.85
8.1.120.0000.00717.43
8.1.110.0080.00017.30
8.1.100.0040.00417.32
8.1.90.0040.00417.41
8.1.80.0060.00317.41
8.1.70.0070.00417.47
8.1.60.0030.00617.69
8.1.50.0030.00517.63
8.1.40.0000.00717.56
8.1.30.0040.00417.63
8.1.20.0040.00417.69
8.1.10.0040.00417.44
8.1.00.0040.00417.42
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.39
8.0.270.0030.00317.29
8.0.260.0070.00017.20
8.0.250.0000.00716.91
8.0.240.0080.00017.02
8.0.230.0000.00616.97
8.0.220.0000.00716.84
8.0.210.0000.00716.86
8.0.200.0000.00716.94
8.0.190.0000.00716.88
8.0.180.0050.00316.89
8.0.170.0000.00716.79
8.0.160.0040.00416.86
8.0.150.0040.00316.83
8.0.140.0000.00716.85
8.0.130.0030.00313.30
8.0.120.0040.00416.84
8.0.110.0000.00716.75
8.0.100.0080.00016.87
8.0.90.0000.00716.88
8.0.80.0060.00916.80
8.0.70.0040.00416.73
8.0.60.0000.00916.73
8.0.50.0000.00716.85
8.0.30.0080.01117.19
8.0.20.0150.00917.40
8.0.10.0040.00417.02
8.0.00.0180.00616.77
7.4.330.0000.00615.55
7.4.320.0040.00416.52
7.4.300.0060.00016.65
7.4.290.0040.00416.48
7.4.280.0080.00016.42
7.4.270.0000.00616.52
7.4.260.0070.00016.52
7.4.250.0070.00016.42
7.4.240.0000.00716.55
7.4.230.0070.00016.61
7.4.220.0070.01116.44
7.4.210.0090.00616.56
7.4.200.0030.00616.33
7.4.160.0110.00916.56
7.4.150.0110.00817.40
7.4.140.0110.01317.86
7.4.130.0110.00616.62
7.4.120.0120.00516.65
7.4.110.0060.01116.49
7.4.100.0100.00716.64
7.4.90.0060.01216.68
7.4.80.0090.01519.39
7.4.70.0060.01116.73
7.4.60.0090.00616.50
7.4.50.0040.01416.66
7.4.40.0080.01016.54
7.4.30.0090.00616.41
7.4.00.0090.00615.11
7.3.330.0000.00713.39
7.3.320.0020.00213.32
7.3.310.0030.00316.20
7.3.300.0070.00016.34
7.3.290.0050.00216.41
7.3.280.0070.01016.35
7.3.270.0190.00417.40
7.3.260.0080.00816.46
7.3.250.0080.01016.53
7.3.240.0090.00816.49
7.3.230.0140.00716.41
7.3.210.0030.01316.41
7.3.200.0090.00616.31
7.3.190.0030.01316.29
7.3.180.0130.00916.66
7.3.170.0030.01416.37
7.3.160.0100.00716.46
7.3.120.0000.01615.00
7.3.110.0000.01614.92
7.3.100.0090.00314.50
7.3.90.0090.00614.71
7.3.80.0040.00814.90
7.3.70.0060.00314.75
7.3.60.0110.00414.99
7.3.50.0070.00714.70
7.3.40.0080.00314.65
7.3.30.0060.00914.88
7.3.20.0070.00416.80
7.3.10.0030.00716.70
7.3.00.0110.00716.77
7.2.330.0370.01716.60
7.2.320.0140.00316.57
7.2.310.0080.00816.27
7.2.300.0160.00016.79
7.2.290.0090.00916.76
7.2.250.0030.01314.96
7.2.240.0120.00615.00
7.2.230.0040.01115.19
7.2.220.0040.01114.89
7.2.210.0090.00315.24
7.2.200.0000.01515.09
7.2.190.0060.00915.18
7.2.180.0090.00315.07
7.2.170.0090.00614.88
7.2.60.0060.00616.97
7.1.330.0060.00915.88
7.1.320.0090.00315.82
7.1.310.0040.01115.63
7.1.300.0070.00315.77
7.1.290.0000.01515.67
7.1.280.0040.01115.58
7.1.270.0070.00715.86
7.1.260.0090.00315.80
7.1.200.0120.00015.76
7.1.70.0000.01017.16
7.1.60.0000.01117.04
7.1.00.0270.06220.84
7.0.200.0060.00314.77
7.0.140.0330.05020.11
7.0.130.0200.06320.30
7.0.120.0230.05720.38
7.0.110.0200.06720.21
7.0.100.0330.08320.29
7.0.90.0430.06320.35
7.0.80.0370.05720.16
7.0.70.0200.06020.34
7.0.60.0230.06020.00
7.0.50.0600.07320.25
7.0.40.0070.07720.24
7.0.30.0270.05720.38
7.0.20.0230.06020.19
7.0.10.0330.05020.37
7.0.00.0100.05320.39
5.6.280.0170.05020.83
5.6.270.0170.06720.92
5.6.260.0100.06021.11
5.6.250.0200.06020.90
5.6.240.0130.06321.06
5.6.230.0170.07021.05
5.6.220.0170.05321.10
5.6.210.0030.06721.02
5.6.200.0170.07320.89
5.6.190.0100.07321.04
5.6.180.0170.05721.03
5.6.170.0070.06020.86
5.6.160.0000.06320.88
5.6.150.0070.06021.07
5.6.140.0070.06021.03
5.6.130.0100.05721.01
5.6.120.0030.06721.00
5.6.110.0170.05020.72
5.6.100.0130.05721.01
5.6.90.0200.04321.05
5.6.80.0030.06020.20
5.6.70.0130.05020.25
5.6.60.0070.06020.14
5.6.50.0070.05720.43
5.6.40.0100.05320.18
5.6.30.0100.05720.34
5.6.20.0030.06020.22
5.6.10.0200.04020.41
5.6.00.0130.04720.07

preferences:
128.84 ms | 403 KiB | 5 Q