3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CachingProxy { private $cache = null; private $instance = null; public function __construct(Memcache $cache, $instance) { $this->cache = $cache; $this->instance = $instance; } public function __call($method, $arguments) { if (substr($method, 0, 3) !== 'get') { $result = call_user_func_array($method, $arguments); } else { $uniqueId = $method . serialize($arguments); $result = $this->cache->get($uniqueId); if ($result === false) { $result = call_user_func_array($method, $arguments); $this->cache->set($uniqueId, $result); } } return $result; } } class ImportantService { public function getInformation($uniqueIdentifier) { echo 'banana'; } } $cachedService = new CachingProxy(new Memcache(), new ImportantService()); $result = $cachedService->getInformation(123); // First call goes to a data source $more = $cachedService->getInformation(123); // From cache now
based on rTVRA

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.2.60.0160.00516.54
7.2.00.0070.00719.25
7.1.200.0040.00815.55
7.1.100.0070.01017.84
7.1.70.0030.00317.03
7.1.60.0100.01619.29
7.1.50.0160.01634.66
7.1.00.0070.07022.51
7.0.200.0000.00716.70
7.0.60.0030.04720.04
7.0.50.0070.08317.89
7.0.40.0100.08020.23
7.0.30.0330.07320.24
7.0.20.0300.07720.19
7.0.10.0000.04720.25
7.0.00.0030.04320.16
5.6.280.0030.03321.13
5.6.210.0170.06320.58
5.6.200.0070.07318.20
5.6.190.0100.08720.67
5.6.180.0300.04720.46
5.6.170.0230.08320.45
5.6.160.0070.03720.51
5.6.150.0100.07718.15
5.6.140.0070.08318.21
5.6.130.0000.07718.18
5.6.120.0070.06021.00
5.6.110.0070.04321.02
5.6.100.0070.06020.99
5.6.90.0100.08721.05
5.6.80.0100.08020.39
5.5.350.0300.07320.43
5.5.340.0130.07317.95
5.5.330.0030.04720.13
5.5.320.0030.04020.27
5.5.310.0170.04720.30
5.5.300.0100.07717.98
5.5.290.0070.06018.02
5.5.280.0070.08320.70
5.5.270.0130.07320.66
5.5.260.0130.08020.77
5.5.250.0070.08320.80
5.5.240.0270.07320.09
5.4.450.0230.03719.27
5.4.440.0230.04719.27
5.4.430.0330.07319.48
5.4.420.0300.07019.38
5.4.410.0300.05019.34
5.4.400.0230.07319.22
5.4.390.0400.06319.15
5.4.380.0330.06318.88
5.4.370.0300.06719.13
5.4.360.0300.07019.13
5.4.350.0370.06019.18
5.4.340.0200.05019.09
5.4.320.0270.07019.24
5.4.310.0330.06319.24
5.4.300.0300.07319.21
5.4.290.0370.06319.24
5.4.280.0270.06319.09
5.4.270.0300.06019.21
5.4.260.0230.06019.08
5.4.250.0300.06319.17
5.4.240.0230.06719.13
5.4.230.0370.05719.21
5.4.220.0270.05019.23
5.4.210.0270.03318.99
5.4.200.0270.06018.94
5.4.190.0200.05018.93
5.4.180.0230.04319.18
5.4.170.0300.07319.30
5.4.160.0330.06719.29
5.4.150.0200.08318.96
5.4.140.0330.06016.72
5.4.130.0270.03316.55
5.4.120.0370.04016.43
5.4.110.0230.03716.46
5.4.100.0300.06316.21
5.4.90.0230.07316.66
5.4.80.0300.06716.62
5.3.290.0270.07314.76
5.3.280.0270.04014.58
5.3.270.0200.08314.54
5.3.260.0370.06714.62
5.3.250.0300.04314.59
5.3.240.0300.04314.77
5.3.230.0330.06714.72
5.3.220.0300.07014.74
5.3.210.0330.03714.49
5.3.200.0230.04714.55
5.3.190.0300.05714.65
5.3.180.0270.05714.73