3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function stripLocationName($name, $length = 30) { if(strlen($name) > $length) { $iata = false; if(preg_match("/ \[[A-Z]{3}\]/", $name, $iata)) { $name = substr($name, 0, -6); $iata = $iata[0]; } $name = substr($name, 0, $length - ($iata ? strlen($iata)+3 : 0)) . ($iata ? '...' . strtoupper($iata) : ''); } return $name; } $name = 'Sumburgh - Shetlandsöarna Flygplats [LSI]'; echo strlen($name) . '<br>'; $name = stripLocationName($name); echo $name; echo ' . ' . strlen($name);

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.0rc40.0180.00798.97
7.3.0rc30.0240.00016.66
7.3.0beta10.0070.00412.79
7.3.0alpha10.0050.00313.08
7.2.60.0100.00616.75
7.2.00.0030.01019.88
7.1.200.0070.00716.08
7.1.100.0060.00918.46
7.1.70.0040.00917.16
7.1.60.0160.00619.17
7.1.50.0030.01717.12
7.1.00.0030.04022.38
7.0.200.0000.00716.75
7.0.140.0030.07322.07
7.0.120.0070.07022.04
7.0.60.0200.07319.85
7.0.50.0070.04017.75
7.0.40.0200.07320.16
7.0.30.0570.07320.20
7.0.20.0300.07320.09
7.0.10.0070.07720.22
7.0.00.0070.08320.31
5.6.210.0030.09020.47
5.6.200.0070.05318.16
5.6.190.0070.06320.48
5.6.180.4300.04320.79
5.6.170.0230.04720.47
5.6.160.0000.09020.48
5.6.150.0070.08718.17
5.6.140.0070.07018.15
5.6.130.0070.08018.21
5.6.120.0030.04021.02
5.6.110.0100.06720.89
5.6.100.0070.03720.89
5.6.90.0130.08020.99
5.6.80.0000.08020.38
5.6.70.4470.03720.54
5.5.350.0400.06320.41
5.5.340.0130.07317.99
5.5.330.0170.06020.35
5.5.320.0270.06720.25
5.5.310.0270.04720.24
5.5.300.0030.06318.09
5.5.290.0070.05717.98
5.5.280.0130.06320.76
5.5.270.0030.04020.87
5.5.260.0070.07720.88
5.5.250.0030.04320.54
5.5.240.0300.07020.16
5.4.450.0170.04319.41
5.4.440.0070.07719.48
5.4.430.0100.04019.30
5.4.420.0130.07319.56
5.4.410.0000.04719.17
5.4.400.0100.03319.20
5.4.390.0100.07319.15
5.4.380.0030.06019.14
5.4.370.0070.03719.14
5.4.360.0000.04319.12
5.4.350.0100.03019.14
5.4.340.0100.08019.15
5.4.320.0070.07719.25
5.4.310.0100.08719.14
5.4.300.0070.03318.89
5.4.290.0030.04718.87
5.4.280.0030.05019.07
5.4.270.0070.04019.14
5.4.260.0130.06719.14
5.4.250.0100.05019.20
5.4.240.0070.06719.23
5.4.230.0030.06319.11
5.4.220.0070.07319.15
5.4.210.0000.05319.23
5.4.200.0000.04319.01
5.4.190.0030.07719.07
5.4.180.0030.06718.84
5.4.170.0100.05719.19
5.4.160.0070.07719.13
5.4.150.0070.05319.13
5.4.140.0070.07016.43
5.4.130.0070.04016.57
5.4.120.0000.04316.44
5.4.110.0030.03716.52
5.4.100.0030.07016.44
5.4.90.0100.05016.36
5.4.80.0170.05716.48
5.4.70.0200.06716.38
5.4.60.0070.07016.34
5.4.50.0130.06716.31
5.4.40.0030.05316.36
5.4.30.0130.07016.38
5.4.20.0100.04716.40
5.4.10.0130.05716.42
5.4.00.0100.07315.80
5.3.290.0130.07314.71
5.3.280.0070.07714.64
5.3.270.0070.07714.64
5.3.260.0070.07714.63
5.3.250.0100.07314.60
5.3.240.0100.05714.60
5.3.230.0100.05314.61
5.3.220.0000.06314.62
5.3.210.0000.05014.57
5.3.200.0100.03714.61
5.3.190.0030.05014.71
5.3.180.0100.07014.57
5.3.170.0070.07714.56
5.3.160.0000.04714.62
5.3.150.0100.08314.72
5.3.140.0030.07014.61
5.3.130.0100.06314.58
5.3.120.0170.06314.60
5.3.110.0070.07714.54
5.3.100.0100.05314.08
5.3.90.0070.04014.07
5.3.80.0070.04013.98
5.3.70.0030.03714.03
5.3.60.0070.03314.08
5.3.50.0030.03714.04
5.3.40.0170.04313.98
5.3.30.0170.04013.94
5.3.20.0070.04713.70
5.3.10.0070.04013.68
5.3.00.0030.07713.70
5.2.170.0070.05711.14
5.2.160.0070.06311.22
5.2.150.0100.04711.07
5.2.140.0130.03711.16
5.2.130.0100.05311.10
5.2.120.0100.02711.10
5.2.110.0030.03311.09
5.2.100.0000.03711.09
5.2.90.0030.06311.11
5.2.80.0000.06011.02
5.2.70.0170.02311.09
5.2.60.0170.05311.21
5.2.50.0100.02311.16
5.2.40.0100.03710.96
5.2.30.0000.03710.97
5.2.20.0030.04011.00
5.2.10.0070.05710.75
5.2.00.0000.06710.75
5.1.60.0000.0339.95
5.1.50.0100.0509.95
5.1.40.0170.04710.13
5.1.30.0070.03710.49
5.1.20.0070.05310.36
5.1.10.0000.03310.05
5.1.00.0030.02310.03
5.0.50.0030.0179.43
5.0.40.0030.0179.43
5.0.30.0000.0309.43
5.0.20.0000.0209.43
5.0.10.0030.0239.43
5.0.00.0070.0239.43
4.4.90.0100.0239.43
4.4.80.0000.0379.43
4.4.70.0030.0339.43
4.4.60.0000.0179.43
4.4.50.0000.0179.43
4.4.40.0000.0579.43
4.4.30.0030.0339.43
4.4.20.0070.0239.43
4.4.10.0000.0179.43
4.4.00.0000.0239.43
4.3.110.0000.0209.43
4.3.100.0000.0179.43
4.3.90.0000.0139.43
4.3.80.0030.0209.43
4.3.70.0000.0139.43
4.3.60.0000.0179.43
4.3.50.0000.0139.43
4.3.40.0000.0239.43
4.3.30.0000.0139.43
4.3.20.0030.0139.43
4.3.10.0000.0179.43
4.3.00.0000.0139.43