3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_plain($text) { return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); } $str = '<strong>foobar</strong>'; print strlen($str) . "\n"; $maxlength = 4; $cutlength = $maxlength; while (0 < $delta = strlen(check_plain(substr($str, 0, $cutlength))) - $maxlength) { $cutlength += $delta; } print "\n" . $delta . "\n"; print substr($str, 0, $cutlength);

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.70.0101.99216.38
8.3.60.0032.00116.38
8.3.50.0151.98421.16
8.3.40.0031.99718.68
8.3.30.0071.99518.90
8.3.20.0101.99020.34
8.3.10.0101.99223.48
8.3.00.0101.99419.26
8.2.180.0101.99418.06
8.2.170.0002.00322.96
8.2.160.0131.99020.52
8.2.150.0071.99724.18
8.2.140.0031.99924.66
8.2.130.0131.98926.16
8.2.120.0071.99522.00
8.2.110.0071.99522.13
8.2.100.0031.99917.91
8.2.90.0071.99517.75
8.2.80.0101.99318.49
8.2.70.0071.99618.04
8.2.60.0031.99918.16
8.2.50.0002.00319.28
8.2.40.0002.00321.18
8.2.30.0071.99319.90
8.2.20.0071.99417.81
8.2.10.0002.00218.06
8.2.00.0071.99517.62
8.1.280.0031.99625.92
8.1.270.0071.99423.82
8.1.260.0032.00026.35
8.1.250.0032.00128.09
8.1.240.0002.00223.91
8.1.230.0031.99617.83
8.1.220.0002.00317.78
8.1.210.0032.00018.77
8.1.200.0002.00417.35
8.1.190.0031.99817.00
8.1.180.0002.00018.10
8.1.170.0002.00318.59
8.1.160.0032.00118.95
8.1.150.0031.99918.74
8.1.140.0071.99717.51
8.1.130.0032.00017.80
8.1.120.0071.99417.41
8.1.110.0101.99417.52
8.1.100.0002.00017.43
8.1.90.0031.99917.47
8.1.80.0071.99517.48
8.1.70.0031.99817.45
8.1.60.0071.99917.54
8.1.50.0032.00017.54
8.1.40.0032.00217.54
8.1.30.0002.00217.61
8.1.20.0031.99817.64
8.1.10.0031.99817.55
8.1.00.0002.00417.47
8.0.300.0101.99118.78
8.0.290.0032.00116.63
8.0.280.0031.99718.29
8.0.270.0031.99916.75
8.0.260.0031.99817.10
8.0.250.0071.99416.83
8.0.240.0002.00416.81
8.0.230.0071.99416.88
8.0.220.0031.99916.73
8.0.210.0071.99416.75
8.0.200.0032.00016.78
8.0.190.0031.99916.82
8.0.180.0031.99916.89
8.0.170.0002.00116.82
8.0.160.0071.99716.88
8.0.150.0101.99316.70
8.0.140.0031.99816.80
8.0.130.0131.99113.34
8.0.120.0002.00316.72
8.0.110.0032.00116.64
8.0.100.0002.00116.64
8.0.90.0002.00316.72
8.0.80.0071.99216.76
8.0.70.0031.99816.58
8.0.60.0032.00016.56
8.0.50.0002.00316.77
8.0.30.0211.97817.02
8.0.20.0161.98717.40
8.0.10.0071.99716.67
8.0.00.0241.97716.58
7.4.330.0031.99615.00
7.4.320.0071.99516.32
7.4.300.0031.99916.52
7.4.290.0071.99616.36
7.4.280.0002.00216.35
7.4.270.0031.99916.27
7.4.260.0002.00216.37
7.4.250.0002.00316.35
7.4.240.0022.00116.38
7.4.230.0071.99516.45
7.4.220.0131.98616.46
7.4.210.0121.99016.48
7.4.200.0031.99816.21
7.4.190.0031.99916.54
7.4.160.0171.98716.48
7.4.150.0131.99017.40
7.4.140.0081.99517.86
7.4.130.0111.98316.46
7.4.120.0191.97816.47
7.4.110.0172.45616.52
7.4.100.0162.44516.34
7.4.90.0262.42416.48
7.4.80.0132.44119.39
7.4.70.0442.28516.38
7.4.60.0032.45716.34
7.4.50.0002.49916.43
7.4.40.0382.42222.77
7.4.30.0102.46916.39
7.4.00.0002.49014.73
7.3.330.0032.00013.22
7.3.320.0031.99813.38
7.3.310.0071.99516.25
7.3.300.0031.99716.20
7.3.290.0101.98816.37
7.3.280.0181.98216.21
7.3.270.0161.99317.40
7.3.260.0032.00316.30
7.3.250.0131.99616.34
7.3.240.0071.98416.29
7.3.230.0102.45516.39
7.3.210.0162.45616.61
7.3.200.0162.44919.39
7.3.190.0102.44416.30
7.3.180.0102.46116.32
7.3.170.0132.44816.28
7.3.160.0202.45316.24
7.3.120.0132.47814.91
7.2.330.0162.46916.35
7.2.320.0472.24216.73
7.2.310.0072.47016.61
7.2.300.0162.46316.68
7.2.290.0162.45516.64
7.2.60.0102.48216.90
7.2.00.0102.49119.39
7.1.200.0072.49115.92
7.1.100.0002.50117.95
7.1.70.0072.49517.13
7.1.60.0132.48819.46
7.1.50.0172.48635.13
7.1.00.0032.49722.21
7.0.200.0032.49817.01
7.0.140.0032.49722.13
7.0.60.0132.48720.01
7.0.50.0072.49317.75
7.0.40.0102.47019.92
7.0.30.0232.47719.73
7.0.20.0232.47720.00
7.0.10.0072.49319.83
7.0.00.0132.48720.00
5.6.280.0102.49021.02
5.6.210.0102.49020.54
5.6.200.0002.50018.14
5.6.190.0132.47320.50
5.6.180.0102.49020.47
5.6.170.0202.48020.40
5.6.160.0002.50020.39
5.6.150.0132.48718.16
5.6.140.0032.49718.11
5.6.130.0102.49018.13
5.6.120.0132.48721.00
5.6.110.0032.49720.99
5.6.100.0072.49320.98
5.6.90.0072.49321.01
5.6.80.0072.49320.49
5.5.350.0072.40720.47
5.5.340.0172.44020.94
5.5.330.0232.44720.88
5.5.320.0102.45720.81
5.5.310.0102.45720.93
5.5.300.0202.41320.93
5.5.290.0372.37320.86
5.5.280.0332.38020.98
5.5.270.0102.47020.95
5.5.260.0232.43020.80
5.5.250.0132.41320.49
5.5.240.0102.41720.37
5.4.450.0072.47719.20
5.4.440.0102.42719.23
5.4.430.0132.42319.34
5.4.420.0232.44019.17
5.4.410.0102.43319.07
5.4.400.0202.43019.03
5.4.390.0332.40719.04
5.4.380.0202.41319.02
5.4.370.0102.40318.85
5.4.360.0232.42019.04
5.4.350.0172.45318.85
5.4.340.0232.43719.01
5.4.320.0102.45718.93
5.4.310.0172.43019.10
5.4.300.0072.41019.02
5.4.290.0132.43719.07
5.4.280.0272.44018.84
5.4.270.0232.39018.88
5.4.260.0172.43319.06
5.4.250.0202.30719.09
5.4.240.0132.34318.83
5.4.230.0302.12718.87
5.4.220.0001.92318.94
5.4.210.0201.94719.17
5.4.200.0232.00719.02
5.4.190.0172.36718.88
5.4.180.0172.43018.83
5.4.170.0102.42719.04
5.4.160.0332.42019.19
5.4.150.0372.40718.82
5.4.140.0132.44016.36
5.4.130.0202.38016.32
5.4.120.0102.45716.36
5.4.110.0202.44316.30
5.4.100.0132.42016.47
5.4.90.0272.42716.44
5.4.80.0072.41016.45
5.4.70.0172.44016.53
5.4.60.0072.47316.41
5.4.50.0472.37016.30
5.4.40.0402.27316.31
5.4.30.0302.38016.41
5.4.20.0302.41316.22
5.4.10.0202.42716.43
5.4.00.0102.48015.91
5.3.290.0102.45714.54
5.3.280.0272.09014.36
5.3.270.0072.48714.49
5.3.260.0272.44714.47
5.3.250.0032.48314.38
5.3.240.0102.44314.45
5.3.230.0132.43314.37
5.3.220.0172.40714.42
5.3.210.0172.43314.39
5.3.200.0102.45314.41
5.3.190.0202.44714.42
5.3.180.0372.42714.33
5.3.170.0132.41314.40
5.3.160.0172.41714.35
5.3.150.0132.46314.41
5.3.140.0232.37314.40
5.3.130.0272.37314.26
5.3.120.0302.39714.41
5.3.110.0032.47714.37
5.3.100.0072.44713.90
5.3.90.0172.44714.00
5.3.80.0172.39013.79
5.3.70.0072.45713.79
5.3.60.0072.43713.80
5.3.50.0072.43013.72
5.3.40.0202.43713.73
5.3.30.0272.42313.68
5.3.20.0302.42313.49
5.3.10.0102.45013.40
5.3.00.0072.39713.40
5.2.170.0272.40710.77
5.2.160.0172.43710.92
5.2.150.0132.37310.91
5.2.140.0102.44010.77
5.2.130.0132.42310.99
5.2.120.0272.42010.85
5.2.110.0232.42310.74
5.2.100.0102.40710.92
5.2.90.0072.47710.88
5.2.80.0132.36310.88
5.2.70.0132.40710.86
5.2.60.0202.36310.82
5.2.50.0302.42310.80
5.2.40.0272.39310.80
5.2.30.0072.47710.74
5.2.20.0202.37010.75
5.2.10.0032.43310.71
5.2.00.0032.44310.46
5.1.60.0272.4009.84
5.1.50.0172.4439.75
5.1.40.0102.4609.84
5.1.30.0072.42010.16
5.1.20.0072.43310.15
5.1.10.0172.4079.92
5.1.00.0072.4439.75
5.0.50.0102.4608.35
5.0.40.0132.4438.25
5.0.30.0332.3678.12
5.0.20.0072.4508.10
5.0.10.0232.4178.01
5.0.00.0072.4537.84
4.4.90.0132.4477.05
4.4.80.0172.3707.05
4.4.70.0302.4007.05
4.4.60.0172.3277.04
4.4.50.0072.4337.04
4.4.40.0072.4207.04
4.4.30.0032.4277.04
4.4.20.0072.4337.04
4.4.10.0032.4577.04
4.4.00.0172.4037.04
4.3.110.0132.4277.04
4.3.100.0072.4037.04
4.3.90.0172.4237.04
4.3.80.0002.4307.04
4.3.70.0172.4237.04
4.3.60.0132.4237.04
4.3.50.0202.4007.04
4.3.40.0102.4137.04
4.3.30.0202.4377.04
4.3.20.0102.4407.04
4.3.10.0630.01713.91
4.3.00.0100.03313.91

preferences:
56.88 ms | 401 KiB | 5 Q