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) { 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

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.0170.00318.43
8.3.50.0040.01416.46
8.3.40.0090.00918.85
8.3.30.0100.01018.70
8.3.20.0090.00020.30
8.3.10.0000.00823.66
8.3.00.0060.00317.68
8.2.180.0110.01118.54
8.2.170.0040.01122.96
8.2.160.0100.00320.34
8.2.150.0000.00724.18
8.2.140.0120.00324.66
8.2.130.0050.00226.16
8.2.120.0000.00917.50
8.2.110.0030.00720.53
8.2.100.0090.00317.63
8.2.90.0030.00619.27
8.2.80.0080.00017.97
8.2.70.0000.00817.50
8.2.60.0040.00417.90
8.2.50.0050.00318.07
8.2.40.0000.01119.11
8.2.30.0040.00422.31
8.2.20.0000.00817.61
8.2.10.0000.00817.99
8.2.00.0050.00317.92
8.1.280.0120.00325.92
8.1.270.0060.00323.83
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0080.00022.01
8.1.230.0110.00017.42
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00417.10
8.1.180.0050.00318.10
8.1.170.0030.00618.56
8.1.160.0030.00521.84
8.1.150.0000.00718.82
8.1.140.0030.00617.30
8.1.130.0020.00517.50
8.1.120.0000.00817.42
8.1.110.0000.00717.34
8.1.100.0040.00417.29
8.1.90.0000.00717.27
8.1.80.0000.00717.39
8.1.70.0040.00417.25
8.1.60.0000.00817.38
8.1.50.0040.00417.31
8.1.40.0040.00417.36
8.1.30.0030.00617.67
8.1.20.0000.00817.52
8.1.10.0030.00517.61
8.1.00.0040.00417.45
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0070.00018.39
8.0.270.0030.00317.12
8.0.260.0000.00717.28
8.0.250.0070.00016.96
8.0.240.0070.00016.99
8.0.230.0030.00317.04
8.0.220.0030.00416.84
8.0.210.0030.00416.90
8.0.200.0030.00316.89
8.0.190.0050.00316.96
8.0.180.0060.00316.84
8.0.170.0080.00016.82
8.0.160.0000.00716.86
8.0.150.0030.00316.81
8.0.140.0080.00016.82
8.0.130.0000.00613.26
8.0.120.0050.00316.93
8.0.110.0030.00616.82
8.0.100.0080.00016.86
8.0.90.0040.00416.82
8.0.80.0160.00316.96
8.0.70.0050.00216.87
8.0.60.0000.00817.03
8.0.50.0040.00416.77
8.0.30.0120.00817.05
8.0.20.0090.01017.40
8.0.10.0040.00416.98
8.0.00.0060.01316.64
7.4.330.0050.00015.08
7.4.320.0000.00816.37
7.4.300.0000.00716.55
7.4.290.0000.00816.50
7.4.280.0000.00816.29
7.4.270.0080.00316.39
7.4.260.0040.00416.39
7.4.250.0000.00716.52
7.4.240.0020.00716.53
7.4.230.0080.00016.43
7.4.220.0120.00616.47
7.4.210.0030.01216.46
7.4.200.0030.00316.62
7.4.160.0140.00716.48
7.4.150.0160.00017.40
7.4.140.0090.01117.86
7.4.130.0140.00616.48
7.4.120.0090.00916.61
7.4.110.0140.00316.67
7.4.100.0070.01116.34
7.4.90.0160.00616.45
7.4.80.0090.01219.39
7.4.70.0150.00616.46
7.4.60.0100.00716.53
7.4.50.0050.00316.43
7.4.40.0060.01516.23
7.4.30.0180.00416.44
7.4.00.0030.01515.02
7.3.330.0000.00713.38
7.3.320.0030.00313.25
7.3.310.0040.00416.38
7.3.300.0030.00316.23
7.3.290.0100.00716.35
7.3.280.0110.00716.38
7.3.270.0030.01317.40
7.3.260.0080.00816.49
7.3.240.0090.00916.54
7.3.230.0070.01116.47
7.3.210.0140.00716.60
7.3.200.0160.00316.70
7.3.190.0150.00616.62
7.3.180.0070.00816.60
7.3.170.0170.00016.40
7.3.160.0130.00316.30
7.2.330.0090.01116.48
7.2.320.0100.00716.60
7.2.310.0090.01216.52
7.2.300.0080.00816.36
7.2.290.0130.00716.68
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

preferences:
52.39 ms | 400 KiB | 5 Q