3v4l.org

run code in 300+ PHP versions simultaneously
<?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) { $result = $this->cache->get($uniqueIdentifier); if ($result === false) { $result = $this->dataSource->getOne($uniqueIdentifier); $this->cache->set($uniqueIdentifier, $result); } return $result; } } $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

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.0190.00318.56
8.3.50.0160.00521.09
8.3.40.0060.00918.67
8.3.30.0070.00718.75
8.3.20.0140.00320.05
8.3.10.0030.00523.48
8.3.00.0000.00819.51
8.2.180.0150.00616.75
8.2.170.0110.00422.96
8.2.160.0070.01020.58
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0060.00317.50
8.2.110.0040.00720.52
8.2.100.0070.00417.50
8.2.90.0000.00819.28
8.2.80.0030.00517.97
8.2.70.0090.00017.50
8.2.60.0000.00717.90
8.2.50.0040.00418.07
8.2.40.0050.00519.38
8.2.30.0040.00422.29
8.2.20.0050.00317.80
8.2.10.0000.00818.06
8.2.00.0070.00018.06
8.1.280.0120.00325.92
8.1.270.0080.00023.89
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.14
8.1.230.0080.00417.42
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0090.00017.23
8.1.190.0050.00317.00
8.1.180.0050.00318.10
8.1.170.0040.00418.64
8.1.160.0040.00421.88
8.1.150.0000.00718.84
8.1.140.0030.00517.37
8.1.130.0030.00317.51
8.1.120.0000.00817.34
8.1.110.0000.00717.36
8.1.100.0070.00017.24
8.1.90.0000.00717.29
8.1.80.0040.00417.39
8.1.70.0070.00017.34
8.1.60.0080.00017.51
8.1.50.0040.00417.36
8.1.40.0040.00417.46
8.1.30.0030.00517.48
8.1.20.0040.00417.54
8.1.10.0000.00717.54
8.1.00.0030.00517.40
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.39
8.0.270.0030.00317.21
8.0.260.0030.00317.13
8.0.250.0070.00016.93
8.0.240.0040.00416.85
8.0.230.0040.00416.98
8.0.220.0040.00416.94
8.0.210.0000.00716.88
8.0.200.0030.00316.86
8.0.190.0000.00816.96
8.0.180.0040.00416.91
8.0.170.0000.00816.93
8.0.160.0070.00016.95
8.0.150.0040.00416.89
8.0.140.0040.00416.88
8.0.130.0000.00613.38
8.0.120.0000.00816.76
8.0.110.0050.00216.82
8.0.100.0000.00816.72
8.0.90.0000.00716.86
8.0.80.0070.01016.99
8.0.70.0070.00016.82
8.0.60.0000.00716.78
8.0.50.0000.00716.94
8.0.30.0070.01217.17
8.0.20.0110.00817.40
8.0.10.0040.00416.79
8.0.00.0120.00816.73
7.4.330.0030.00315.08
7.4.320.0040.00416.41
7.4.300.0040.00416.52
7.4.290.0030.00316.34
7.4.280.0050.00516.53
7.4.270.0000.00916.55
7.4.260.0080.00016.51
7.4.250.0030.00316.32
7.4.240.0020.00516.46
7.4.230.0070.00016.43
7.4.220.0000.02616.50
7.4.210.0070.01016.62
7.4.200.0040.00416.29
7.4.160.0100.00516.42
7.4.150.0090.00817.40
7.4.140.0130.01117.86
7.4.130.0140.00816.59
7.4.120.0110.01016.60
7.4.110.0060.01516.38
7.4.100.0200.00316.67
7.4.90.0160.00616.49
7.4.80.0070.01019.39
7.4.70.0050.01116.40
7.4.60.0090.00616.40
7.4.50.0050.00016.35
7.4.40.0070.01416.28
7.4.30.0140.00316.49
7.4.00.0060.00914.92
7.3.330.0030.00313.38
7.3.320.0000.00713.36
7.3.310.0040.00416.39
7.3.300.0080.00016.25
7.3.290.0090.00616.37
7.3.280.0090.00716.36
7.3.270.0130.00417.40
7.3.260.0130.00316.38
7.3.240.0100.01016.35
7.3.230.0070.01016.53
7.3.210.0000.01516.36
7.3.200.0100.01016.48
7.3.190.0070.01016.50
7.3.180.0060.00916.33
7.3.170.0000.01616.27
7.3.160.0110.00416.35
7.3.10.0130.00416.31
7.3.00.0150.00516.40
7.2.330.0120.00616.24
7.2.320.0100.01316.67
7.2.310.0100.01016.61
7.2.300.0070.01016.50
7.2.290.0120.00916.58
7.2.130.0130.00516.66
7.2.120.0110.00816.65
7.2.110.0130.00716.48
7.2.100.0120.01016.57
7.2.90.0070.01016.38
7.2.80.0090.00816.70
7.2.70.0100.01016.65
7.2.60.0130.00316.63
7.2.50.0110.00516.46
7.2.40.0070.00916.56
7.2.30.0120.00716.64
7.2.20.0070.01116.55
7.2.10.0110.00916.57
7.2.00.0070.01017.55
7.1.250.0130.00515.26
7.1.200.0060.00615.73
7.1.100.0000.01717.68
7.1.70.0000.00817.09
7.1.60.0090.01219.29
7.1.50.0220.01334.58
7.1.00.0100.06722.45
7.0.200.0000.01016.70
7.0.60.0200.07719.86
7.0.50.0100.04017.84
7.0.40.0030.08720.21
7.0.30.0370.07320.09
7.0.20.0370.04720.24
7.0.10.0030.04320.16
7.0.00.0100.08320.23
5.6.280.0030.03321.09
5.6.210.0030.06020.67
5.6.200.0100.04318.19
5.6.190.0000.04720.61
5.6.180.0270.07720.61
5.6.170.0230.05720.46
5.6.160.0130.08020.50
5.6.150.0070.06318.18
5.6.140.0270.06018.14
5.6.130.0130.08018.27
5.6.120.0030.08321.02
5.6.110.0130.07721.05
5.6.100.0130.07720.99
5.6.90.0070.09020.99
5.6.80.0000.04020.52
5.5.350.3970.04020.46
5.5.340.0100.07717.94
5.5.330.0030.06020.45
5.5.320.0330.08020.31
5.5.310.0200.06720.25
5.5.300.0070.04718.08
5.5.290.0130.03018.08
5.5.280.0070.05020.86
5.5.270.0070.08720.88
5.5.260.0200.07020.74
5.5.250.0200.07020.56
5.5.240.0300.06320.30
5.4.450.0800.05719.47
5.4.440.0770.07319.20
5.4.430.0730.07019.59
5.4.420.0830.04719.38
5.4.410.0770.05019.35
5.4.400.0930.06019.22
5.4.390.0700.06319.07
5.4.380.1000.06718.98
5.4.370.0900.06318.87
5.4.360.0930.07719.25
5.4.350.0730.06018.99
5.4.340.0800.07019.30
5.4.320.0870.06719.25
5.4.310.0900.05718.98
5.4.300.0930.05019.21
5.4.290.0930.05718.98
5.4.280.0700.07019.30
5.4.270.0830.05019.05
5.4.260.0770.05319.00
5.4.250.0870.05018.99
5.4.240.0730.06019.21
5.4.230.0900.04719.13
5.4.220.0830.08019.00
5.4.210.0930.06019.00
5.4.200.0900.06719.05
5.4.190.0970.07318.98
5.4.180.0900.04719.25
5.4.170.0930.06719.05
5.4.160.0800.06019.19
5.4.150.1100.06719.03
5.4.140.1130.05716.41
5.4.130.0830.05016.79
5.4.120.0870.05016.77
5.4.110.0930.05716.70
5.4.100.0800.05716.57
5.4.90.0800.04716.60
5.4.80.0870.06016.49
5.4.70.0170.06016.44
5.4.60.0130.04716.56
5.4.50.0100.06316.49
5.4.40.0230.06016.51
5.4.30.0270.05016.50
5.4.20.0170.04316.53

preferences:
56.19 ms | 401 KiB | 5 Q