3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User { public function filterName($fullName) { return filter_var($fullName, FILTER_CALLBACK, ['options'=>function($value) { $value = trim($value); // strip tags $value = strip_tags($value); // remove double quotes $value = preg_replace('/["<>\{\}\[\]]+/', '', $value); return $value; }]); } } $user = new User; echo $user->filterName('Foo!"bar" Baz ø hello!<strong>poop</strong>') . "\n"; echo $user->filterName('@непроизносимые 誤解 की اللغويات') . "\n";
based on LHNTT

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.10.0100.00516.57
7.3.00.0080.00516.53
7.2.130.0120.00716.86
7.2.120.0110.00716.83
7.2.110.0060.01016.94
7.2.100.0070.00916.91
7.2.90.0140.00616.81
7.2.80.0120.00516.88
7.2.70.0120.00716.93
7.2.60.0100.01017.04
7.2.50.0100.01016.67
7.2.40.0120.00616.77
7.2.30.0090.01316.80
7.2.20.0110.00816.92
7.2.10.0120.00616.73
7.2.00.0070.01018.06
7.1.250.0120.00415.60
7.1.100.0000.01118.30
7.1.70.0000.00717.39
7.1.60.0090.01620.03
7.1.50.0110.01117.10
7.1.00.0130.06722.32
7.0.200.0910.00416.94
7.0.110.0170.04320.02
7.0.100.0200.07320.05
7.0.90.0100.05719.95
7.0.80.0200.03319.96
7.0.70.0100.05319.96
7.0.60.0130.07319.89
7.0.50.0130.08020.08
7.0.40.0100.07019.78
7.0.30.0030.04719.87
7.0.20.0000.04719.88
7.0.10.0000.07319.74
7.0.00.0030.04319.81
5.6.260.0070.07720.70
5.6.250.0030.04320.67
5.6.240.0100.07720.71
5.6.230.0070.08720.66
5.6.220.0030.08720.66
5.6.210.0130.07720.61
5.6.200.0130.07720.48
5.6.190.0030.06020.65
5.6.180.0100.07020.60
5.6.170.0130.06320.56
5.6.160.0100.03720.64
5.6.150.0000.04320.66
5.6.140.0030.09020.63
5.6.130.0000.07720.65
5.6.120.0030.04320.66
5.6.110.0100.06720.69
5.6.100.0030.07720.64
5.6.90.0030.08320.64
5.6.80.0130.06320.02
5.6.70.0070.08019.84
5.6.60.0030.07720.07
5.6.50.0130.06320.03
5.6.40.0130.07319.83
5.6.30.0170.07320.05
5.6.20.0100.07319.92
5.6.10.0030.07720.03
5.6.00.0030.08019.92
5.5.380.0100.04717.56
5.5.370.0100.07717.70
5.5.360.0170.07317.68
5.5.350.0100.07017.55
5.5.340.0030.08318.05
5.5.330.0100.04018.23
5.5.320.0030.04018.25
5.5.310.0000.05717.95
5.5.300.0030.06718.05
5.5.290.0100.03718.09
5.5.280.0000.08318.23
5.5.270.0100.05018.05
5.5.260.0070.04717.91
5.5.250.0070.06717.94
5.5.240.0070.07017.52
5.5.230.0070.07017.29
5.5.220.0070.07317.61
5.5.210.0030.08017.48
5.5.200.0000.08017.61
5.5.190.0100.07317.40
5.5.180.0200.06717.49
5.5.160.0030.07717.45
5.5.150.0130.06717.28
5.5.140.0100.07017.18
5.5.130.0070.06717.57
5.5.120.0000.05317.27
5.5.110.0100.03317.27
5.5.100.0070.04017.50
5.5.90.0070.03317.32
5.5.80.0030.03717.38
5.5.70.0030.05317.34
5.5.60.0030.03717.47
5.5.50.0200.02317.36
5.5.40.0030.03717.31
5.5.30.0070.03317.16
5.5.20.0030.06017.20
5.5.10.0130.03317.15
5.5.00.0100.08317.36
5.4.450.0000.06019.55
5.4.440.0030.04319.49
5.4.430.0070.03719.33
5.4.420.0100.07319.41
5.4.410.0070.07319.45
5.4.400.0100.07019.03
5.4.390.0030.08019.31
5.4.380.0130.05719.02
5.4.370.0000.07319.14
5.4.360.0030.03718.95
5.4.350.0030.07718.99
5.4.340.0030.06319.26
5.4.320.0030.07719.00
5.4.310.0130.07319.31
5.4.300.0030.08019.16
5.4.290.0030.08019.01
5.4.280.0200.06319.00
5.4.270.0100.03319.33
5.4.260.0100.03019.01
5.4.250.0030.04319.18
5.4.240.0000.04019.02
5.4.230.0000.04018.95
5.4.220.0030.03719.02
5.4.210.0030.04018.98
5.4.200.0070.03319.00
5.4.190.0030.03718.97
5.4.180.0000.03319.03
5.4.170.0100.06319.21
5.4.160.0100.05719.06
5.4.150.0070.07718.92
5.4.140.0000.06016.35
5.4.130.0000.05316.36
5.4.120.0070.03016.57
5.4.110.0070.07716.47
5.4.100.0000.05016.63
5.4.90.0030.03316.50
5.4.80.0030.03316.54
5.4.70.0030.03316.35
5.4.60.0000.03316.54
5.4.50.0030.04016.34
5.4.40.0030.03716.60
5.4.30.0070.03316.29
5.4.20.0000.04016.48
5.4.10.0070.03316.23
5.4.00.0030.04316.01