3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'StackOverFlow is the best site ever', // 22 ----------------^ 'http://stackoverflow.com is the best site ever', // 22 ----------------^ 'Short string', // no ellipsis needed ^ 'pneumonoultramicroscopicsilicovolcanoconiosis', // breakpoint between ^ letters ]; $link = '<a href="/this/story">Read More</a>'; function ShortenText($text, $chars) { $chars = $chars;$text = $text." "; $countchars = strlen($text); if($countchars > $chars) { $text = substr($text,0,$chars); $text = substr($text,0,strrpos($text,' ')); $text = $text."..."; } return $text; } foreach ($strings as $string) { var_export( ShortenText($string, 22) ); 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.5.10.0100.00820.01
8.5.00.0130.00922.92
8.4.150.0030.00014.05
8.4.140.0140.00717.54
8.4.130.0130.00719.51
8.4.120.0030.00520.81
8.4.110.0100.00624.04
8.4.100.0140.00717.85
8.4.90.0060.01020.69
8.4.80.0110.00918.84
8.4.70.0030.00519.03
8.4.60.0130.00718.78
8.4.50.0090.00519.70
8.4.40.0130.00619.39
8.4.30.0130.00620.26
8.4.20.0120.00617.93
8.4.10.0080.01222.14
8.3.280.0100.01118.43
8.3.270.0110.00816.65
8.3.260.0100.01016.57
8.3.250.0090.00918.85
8.3.240.0140.00618.95
8.3.230.0130.00516.81
8.3.220.0110.00719.06
8.3.210.0070.00216.48
8.3.200.0050.00416.84
8.3.190.0100.01019.02
8.3.180.0070.00316.65
8.3.170.0070.01116.59
8.3.160.0120.00616.48
8.3.150.0150.00317.18
8.3.140.0040.00420.91
8.3.130.0040.00418.09
8.3.120.0040.00420.74
8.3.110.0000.00716.66
8.3.100.0070.00316.29
8.3.90.0070.01126.77
8.3.80.0030.00618.43
8.3.70.0140.00716.75
8.3.60.0120.00318.30
8.3.50.0030.01220.02
8.3.40.0130.00721.89
8.3.30.0060.01218.59
8.3.20.0070.00724.18
8.3.10.0080.00024.66
8.3.00.0030.00526.16
8.2.290.0020.00616.48
8.2.280.0140.00518.55
8.2.270.0120.00616.72
8.2.260.0120.00618.91
8.2.250.0080.00016.76
8.2.240.0060.00318.91
8.2.230.0000.00820.94
8.2.220.0060.00337.54
8.2.210.0030.00526.77
8.2.200.0060.00317.97
8.2.190.0090.01216.58
8.2.180.0140.00425.92
8.2.170.0110.01118.95
8.2.160.0110.00322.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0000.00719.45
8.2.110.0060.00320.52
8.2.100.0070.00417.91
8.2.90.0000.00817.75
8.2.80.0030.00518.61
8.2.70.0040.00417.63
8.2.60.0040.00417.50
8.2.50.0000.00818.04
8.2.40.0050.00319.82
8.2.30.0030.00617.93
8.2.20.0000.00720.31
8.2.10.0000.00818.17
8.2.00.0000.00819.21
8.1.330.0110.00816.19
8.1.320.0100.00715.92
8.1.310.0030.01316.90
8.1.300.0170.00319.60
8.1.290.0090.00030.84
8.1.280.0070.01025.92
8.1.270.0080.00323.99
8.1.260.0030.01226.35
8.1.250.0040.00428.09
8.1.240.0070.00319.10
8.1.230.0040.00817.77
8.1.220.0000.00817.74
8.1.210.0100.00018.77
8.1.200.0000.00917.25
8.1.190.0060.00317.23
8.1.180.0060.00318.10
8.1.170.0040.00417.65
8.1.160.0040.00418.94
8.1.150.0070.00018.68
8.1.140.0060.00317.50
8.1.130.0070.00018.93
8.1.120.0030.00617.47
8.1.110.0040.00417.43
8.1.100.0040.00417.50
8.1.90.0040.00417.53
8.1.80.0080.00017.43
8.1.70.0110.00517.39
8.1.60.0080.00717.43
8.1.50.0190.00017.49
8.1.40.0140.00317.39
8.1.30.0190.00017.53
8.1.20.0160.00317.56
8.1.10.0000.01817.51
8.1.00.0110.00717.30
8.0.300.0060.00318.77
8.0.290.0000.00816.75
8.0.280.0050.00518.47
8.0.270.0030.00316.78
8.0.260.0040.00418.48
8.0.250.0030.00316.97
8.0.240.0070.00016.99
8.0.230.0000.01016.82
8.0.220.0030.00516.90
8.0.210.0080.00816.82
8.0.200.0110.00316.92
8.0.190.0090.00616.90
8.0.180.0130.00316.83
8.0.170.0110.00416.95
8.0.160.0110.00416.76
8.0.150.0120.00316.93
8.0.140.0140.00016.79
8.0.130.0150.00016.84
8.0.120.0050.01016.76
8.0.110.0090.00516.89
8.0.100.0080.00616.77
8.0.90.0120.00216.84
8.0.80.0120.00316.71
8.0.70.0170.00016.82
8.0.60.0100.00716.85
8.0.50.0120.00316.77
8.0.30.0090.00316.75
8.0.20.0030.01216.84
8.0.10.0100.00317.05
7.4.330.0000.00515.55
7.4.320.0000.00616.53
7.4.300.0080.00816.61
7.4.290.0140.00416.59
7.4.280.0080.00816.48
7.4.270.0090.00916.48
7.4.260.0120.00316.59
7.4.250.0070.00716.35
7.4.240.0170.00016.45
7.4.230.0110.00616.53
7.4.220.0120.00316.50
7.4.210.0100.00516.48
7.4.200.0090.00516.48
7.4.190.0100.00516.53
7.4.180.0150.00016.58
7.4.160.0160.00016.57
7.4.150.0130.00016.51
7.4.140.0150.00016.34
7.4.130.0100.00416.51
7.4.120.0120.00216.46
7.4.110.0090.00516.51
7.4.100.0060.00916.51
7.4.90.0120.00316.38
7.4.80.0120.00216.41
7.4.70.0070.00616.32
7.4.60.0080.00616.52
7.4.50.0050.00916.25
7.4.40.0050.00916.41
7.4.30.0090.00616.48
7.4.20.0090.00516.33
7.4.10.0130.00016.34
7.4.00.0140.00016.44

preferences:
35.31 ms | 403 KiB | 5 Q