3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cut_off_string_maybe($string, $limit) { if (mb_strlen($string) <= $limit) return htmlspecialchars($string); else return trim(htmlspecialchars(mb_substr($string, 0, $limit, 'UTF-8'))) . '...'; } echo cut_off_string_maybe("This is a test",4); echo cut_off_string_maybe("Whats your problem",4); echo cut_off_string_maybe("OK this is it",5);

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.0140.00716.37
8.3.50.0140.00616.53
8.3.40.0040.01118.53
8.3.30.0150.00018.28
8.3.20.0070.00718.48
8.3.10.0050.00520.40
8.3.00.0060.00919.26
8.2.180.0120.00618.29
8.2.170.0030.01322.96
8.2.160.0110.00419.16
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0040.00421.07
8.2.110.0030.00722.27
8.2.100.0090.00317.89
8.2.90.0040.00419.05
8.2.80.0000.00817.97
8.2.70.0080.00017.50
8.2.60.0030.00517.91
8.2.50.0080.00018.07
8.2.40.0040.00418.09
8.2.30.0040.00418.04
8.2.20.0090.00019.38
8.2.10.0000.00717.56
8.2.00.0040.00417.47
8.1.270.0060.00323.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00318.96
8.1.230.0090.00319.09
8.1.220.0080.00017.74
8.1.210.0030.00618.77
8.1.200.0030.00617.23
8.1.190.0040.00417.53
8.1.180.0000.00818.10
8.1.170.0030.00618.78
8.1.160.0000.00718.84
8.1.150.0000.00718.64
8.1.140.0040.00417.40
8.1.130.0000.00717.71
8.1.120.0000.00817.38
8.1.110.0000.00717.23
8.1.100.0000.00717.45
8.1.90.0040.00417.31
8.1.80.0050.00317.45
8.1.70.0000.00717.31
8.1.60.0000.00817.63
8.1.50.0000.00817.37
8.1.40.0050.00317.58
8.1.30.0060.00317.55
8.1.20.0040.00417.62
8.1.10.0040.00417.50
8.1.00.0000.00817.44
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0000.00718.36
8.0.270.0030.00317.27
8.0.260.0030.00316.86
8.0.250.0000.00716.94
8.0.240.0080.00016.97
8.0.230.0000.00716.98
8.0.220.0040.00416.94
8.0.210.0080.00016.78
8.0.200.0040.00416.89
8.0.190.0040.00416.95
8.0.180.0030.00516.91
8.0.170.0060.00316.82
8.0.160.0030.00316.86
8.0.150.0040.00416.90
8.0.140.0080.00316.82
8.0.130.0030.00313.37
8.0.120.0080.00016.90
8.0.110.0080.00016.73
8.0.100.0000.00716.94
8.0.90.0040.00416.80
8.0.80.0100.00716.92
8.0.70.0000.00816.92
8.0.60.0040.00416.73
8.0.50.0040.00416.82
8.0.30.0130.00616.94
8.0.20.0140.00517.35
8.0.10.0080.00016.94
8.0.00.0110.01416.73
7.4.330.0000.00612.87
7.4.320.0060.00016.52
7.4.300.0060.00016.46
7.4.290.0070.00016.43
7.4.280.0000.00716.55
7.4.270.0070.00016.47
7.4.260.0000.00716.54
7.4.250.0060.00316.57
7.4.240.0000.00816.60
7.4.230.0000.00716.54
7.4.220.0140.00616.46
7.4.210.0090.00616.47
7.4.200.0030.00316.29
7.4.190.0030.00316.64
7.4.160.0180.00416.43
7.4.150.0100.00716.46
7.4.140.0090.01516.51
7.4.130.0140.00716.31
7.4.120.0030.01316.45
7.4.110.0150.00316.44
7.4.100.0100.00716.49
7.4.90.0040.01516.41
7.4.80.0130.01116.34
7.4.70.0100.00716.66
7.4.60.0040.01216.40
7.4.50.0050.00016.46
7.4.40.0090.00216.38
7.4.30.0060.01116.36
7.4.00.0060.00914.94
7.3.330.0030.00313.13
7.3.320.0030.00313.14
7.3.310.0040.00416.20
7.3.300.0000.00716.15
7.3.290.0100.00516.29
7.3.280.0090.00316.32
7.3.270.0170.00316.72
7.3.260.0130.00916.41
7.3.250.0070.01516.65
7.3.240.0130.00316.29
7.3.230.0130.00416.43
7.3.210.0060.01016.27
7.3.200.0110.00819.39
7.3.190.0090.00616.37
7.3.180.0100.00616.27
7.3.170.0070.00716.45
7.3.160.0090.01216.45
7.3.120.0080.00614.96
7.3.110.0090.00914.92
7.3.100.0060.01014.66
7.3.90.0030.01214.89
7.3.80.0060.01214.80
7.3.70.0150.00014.96
7.3.60.0000.01114.85
7.3.50.0070.00714.87
7.3.40.0030.00914.67
7.3.30.0030.01314.86
7.3.20.0030.00916.61
7.3.10.0040.00816.79
7.3.00.0060.00316.72
7.2.330.0100.01016.60
7.2.320.0120.01216.64
7.2.310.0100.00716.73
7.2.300.0200.00016.38
7.2.290.0030.01316.43
7.2.250.0130.00714.90
7.2.240.0150.00414.77
7.2.230.0100.00315.09
7.2.220.0070.00714.54
7.2.210.0090.00914.82
7.2.200.0070.00414.98
7.2.190.0030.01014.95
7.2.180.0120.00314.89
7.2.170.0030.00914.83
7.2.60.0070.00716.92
7.2.00.0090.00919.31
7.1.330.0060.01115.84
7.1.320.0000.01415.74
7.1.310.0140.00315.95
7.1.300.0030.01015.89
7.1.290.0080.00615.89
7.1.280.0040.01115.61
7.1.270.0070.00715.88
7.1.260.0000.01015.58
7.1.200.0090.00315.65
7.1.100.0030.01018.18
7.1.70.0000.00917.24
7.1.60.0030.02019.17
7.1.50.0070.01416.59
7.1.00.0070.07322.43
7.0.200.0510.00414.45
7.0.140.0030.06722.00
7.0.120.0000.06722.06
7.0.60.0030.08320.01
7.0.50.0070.04717.88
7.0.40.0070.05720.13
7.0.30.0330.07720.06
7.0.20.0270.06320.05
7.0.10.0200.04320.25
7.0.00.0100.04020.19
5.6.280.0000.07321.02
5.6.210.0070.07720.73
5.6.200.0030.08318.12
5.6.190.0130.08320.52
5.6.180.0230.05720.59
5.6.170.0170.04320.52
5.6.160.0030.04320.39
5.6.150.0030.04718.16
5.6.140.0200.06718.11
5.6.130.0070.07318.23
5.6.120.0130.07021.13
5.6.110.0100.08021.01
5.6.100.0170.07321.06
5.6.90.0070.07020.97
5.6.80.0030.08320.38
5.6.70.0200.04320.36
5.5.350.0370.07320.43
5.5.340.0170.06317.99
5.5.330.0130.08020.27
5.5.320.0230.07720.27
5.5.310.0270.07320.19
5.5.300.0100.08017.99
5.5.290.0070.03718.07
5.5.280.0100.08020.80
5.5.270.0030.04020.84
5.5.260.0070.08320.88
5.5.250.0200.07320.61
5.5.240.0030.08020.04
5.4.450.0030.06319.57
5.4.440.0030.04019.33
5.4.430.0030.04319.20
5.4.420.0030.04019.24
5.4.410.0070.03319.04
5.4.400.0070.03319.17
5.4.390.0000.04019.24
5.4.380.0070.03318.98
5.4.370.0030.03719.12
5.4.360.0030.05019.23
5.4.350.0030.03718.85
5.4.340.0070.03718.87
5.4.320.0030.04019.23
5.4.310.0070.03318.99
5.4.300.0070.03718.92
5.4.290.0070.03318.85
5.4.280.0000.04019.08
5.4.270.0070.03319.15
5.4.260.0000.04319.24
5.4.250.0000.04018.84
5.4.240.0070.03319.11
5.4.230.0070.03319.00
5.4.220.0030.04019.14
5.4.210.0070.05019.20
5.4.200.0070.07718.84
5.4.190.0000.05019.10
5.4.180.0100.04719.14
5.4.170.0030.07718.91
5.4.160.0030.05019.13
5.4.150.0070.06319.22
5.4.140.0100.04716.33
5.4.130.0030.03716.56
5.4.120.0070.04316.41
5.4.110.0030.04016.36
5.4.100.0070.07716.46
5.4.90.0100.05716.37
5.4.80.0100.07016.49
5.4.70.0030.05716.27
5.4.60.0030.07016.35
5.4.50.0070.03716.64
5.4.40.0030.06016.36
5.4.30.0100.04716.36
5.4.20.0070.07316.26
5.4.10.0070.04316.38
5.4.00.0030.05015.85
5.3.290.0030.03714.67
5.3.280.0000.04714.58
5.3.270.0070.04314.65
5.3.260.0030.05014.68
5.3.250.0130.03014.59
5.3.240.0030.04714.61
5.3.230.0100.06314.75
5.3.220.0130.03314.59
5.3.210.0000.06014.62
5.3.200.0130.06714.59
5.3.190.0070.08014.59
5.3.180.0100.06714.44
5.3.170.0070.07314.71
5.3.160.0030.06714.59
5.3.150.0030.04714.45
5.3.140.0030.03714.54
5.3.130.0100.06314.58
5.3.120.0170.06714.54
5.3.110.0000.06314.71
5.3.100.0070.04014.05
5.3.90.0070.06314.02
5.3.80.0100.03313.98
5.3.70.0030.04014.03
5.3.60.0000.05314.00
5.3.50.0100.05313.90
5.3.40.0030.05313.99
5.3.30.0070.07713.98
5.3.20.0170.07013.72
5.3.10.0130.05013.69
5.3.00.0000.04013.63
5.2.170.0100.05711.07
5.2.160.0100.04311.15
5.2.150.0070.03011.09
5.2.140.0030.03711.20
5.2.130.0000.04011.10
5.2.120.0070.05711.11
5.2.110.0100.05711.11
5.2.100.0070.03011.11
5.2.90.0100.02311.17
5.2.80.0070.03711.05
5.2.70.0070.05311.15
5.2.60.0100.05011.12
5.2.50.0030.06711.07
5.2.40.0130.02710.94
5.2.30.0070.06010.91
5.2.20.0000.03710.95
5.2.10.0100.02010.86
5.2.00.0130.01710.71
5.1.60.0070.0509.96
5.1.50.0030.0309.90
5.1.40.0070.0379.93
5.1.30.0070.05710.41
5.1.20.0030.05310.34
5.1.10.0130.03010.09
5.1.00.0030.05710.02
5.0.50.0000.0238.63
5.0.40.0030.0178.63
5.0.30.0170.0378.63
5.0.20.0030.0308.63
5.0.10.0000.0238.63
5.0.00.0030.0338.63
4.4.90.0000.0378.63
4.4.80.0000.0408.63
4.4.70.0000.0238.63
4.4.60.0000.0378.63
4.4.50.0000.0308.63
4.4.40.0030.0308.63
4.4.30.0030.0378.63
4.4.20.0070.0238.63
4.4.10.0030.0178.63
4.4.00.0000.0478.63
4.3.110.0000.0178.63
4.3.100.0000.0178.63
4.3.90.0000.0278.63
4.3.80.0000.0308.63
4.3.70.0000.0208.63
4.3.60.0000.0208.63
4.3.50.0000.0278.63
4.3.40.0000.0578.63
4.3.30.0030.0238.63
4.3.20.0070.0308.63
4.3.10.0000.0378.63
4.3.00.0030.0338.63

preferences:
46.68 ms | 400 KiB | 5 Q