3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Proxy { private $object; private $onEnter = []; private $onLeave = []; public function __registerOnEnter($method, \Closure $closure) { $this->onEnter[$method][] = $closure; } private function invokeOnEnter($method, array $arguments) { if (empty($this->onEnter[$method])) { return; } foreach ($this->onEnter[$method] as $closure) { call_user_func($closure, $this->object, $arguments); } } public function __registerOnLeave($method, \Closure $closure) { $this->onLeave[$method][] = $closure; } private function invokeOnLeave($method, array $arguments) { if (empty($this->onLeave[$method])) { return; } foreach ($this->onLeave[$method] as $closure) { call_user_func($closure, $this->object, $arguments); } } private function getProxiedMethod($method) { $methodReflection = new \ReflectionMethod($this->object, $method); return $methodReflection->getClosure($this->object)->bindTo($this); } public function __call($method, array $arguments) { $this->invokeOnEnter($method, $arguments); call_user_func_array($this->getProxiedMethod($method), $arguments); $this->invokeOnLeave($method, $arguments); } public function __construct($object) { $this->object = (object) $object; } } class Foo { public function bar() { $this->qux(); } public function qux() { $this->zip(); } public function zip() { var_dump(__CLASS__); } } $fooProxy = new Proxy(new Foo()); $fooProxy->__registerOnEnter('bar', function ($object) { var_dump(sprintf('%s::bar#onEnter', get_class($object))); }); $fooProxy->__registerOnLeave('bar', function ($object) { var_dump(sprintf('%s::bar#onLeave', get_class($object))); }); $fooProxy->__registerOnEnter('qux', function ($object) { var_dump(sprintf('%s::qux#onEnter', get_class($object))); }); $fooProxy->__registerOnLeave('qux', function ($object) { var_dump(sprintf('%s::qux#onLeave', get_class($object))); }); $fooProxy->__registerOnEnter('zip', function ($object) { var_dump(sprintf('%s::zip#onEnter', get_class($object))); }); $fooProxy->__registerOnLeave('zip', function ($object) { var_dump(sprintf('%s::zip#onLeave', get_class($object))); }); $fooProxy->bar();

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.0110.01116.61
8.3.50.0100.00621.99
8.3.40.0090.01218.93
8.3.30.0090.01219.27
8.3.20.0030.00620.34
8.3.10.0000.00823.70
8.3.00.0080.00019.02
8.2.180.0060.01016.63
8.2.170.0070.01122.96
8.2.160.0050.00920.32
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0030.00520.97
8.2.110.0060.00322.22
8.2.100.0060.00619.57
8.2.90.0090.00019.17
8.2.80.0000.00817.97
8.2.70.0070.00417.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0050.00419.95
8.2.30.0000.00718.36
8.2.20.0050.00317.78
8.2.10.0000.00818.32
8.2.00.0080.00017.86
8.1.280.0110.01125.92
8.1.270.0060.00323.82
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00322.20
8.1.230.0080.00418.99
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0090.00017.60
8.1.190.0140.00016.88
8.1.180.0040.00418.10
8.1.170.0090.00018.73
8.1.160.0000.00822.07
8.1.150.0040.00418.70
8.1.140.0070.00017.55
8.1.130.0070.00017.88
8.1.120.0000.00817.51
8.1.110.0040.00417.40
8.1.100.0000.00817.41
8.1.90.0040.00417.47
8.1.80.0030.00617.50
8.1.70.0000.00717.53
8.1.60.0000.00817.64
8.1.50.0060.00317.48
8.1.40.0000.01117.56
8.1.30.0050.00317.66
8.1.20.0000.00817.60
8.1.10.0040.00417.62
8.1.00.0000.00817.48
8.0.300.0030.00618.77
8.0.290.0040.00417.16
8.0.280.0000.00718.50
8.0.270.0040.00417.30
8.0.260.0070.00017.32
8.0.250.0050.00217.12
8.0.240.0000.00716.96
8.0.230.0000.00716.92
8.0.220.0000.00716.98
8.0.210.0070.00016.99
8.0.200.0050.00317.09
8.0.190.0040.00417.08
8.0.180.0060.00317.04
8.0.170.0090.00016.99
8.0.160.0000.00716.89
8.0.150.0000.00717.04
8.0.140.0000.00717.01
8.0.130.0030.00313.46
8.0.120.0030.00516.87
8.0.110.0050.00317.00
8.0.100.0090.00016.81
8.0.90.0070.00017.01
8.0.80.0100.01016.99
8.0.70.0040.00416.96
8.0.60.0050.00217.02
8.0.50.0000.00816.82
8.0.30.0100.00917.09
8.0.20.0090.00917.40
8.0.10.0040.00417.01
8.0.00.0110.00916.81
7.4.330.0050.00015.00
7.4.320.0000.00616.57
7.4.300.0030.00316.55
7.4.290.0000.00816.66
7.4.280.0030.00316.45
7.4.270.0000.00716.66
7.4.260.0000.00716.64
7.4.250.0070.00016.60
7.4.240.0020.00616.61
7.4.230.0000.00816.46
7.4.220.0120.00416.75
7.4.210.0100.00416.63
7.4.200.0050.00216.62
7.4.190.0030.00516.60
7.4.160.0030.01316.53
7.4.150.0090.00917.40
7.4.140.0130.00917.86
7.4.130.0130.00416.63
7.4.120.0120.00716.54
7.4.110.0080.01216.48
7.4.100.0070.01016.50
7.4.90.0030.01616.49
7.4.80.0090.01019.39
7.4.70.0110.00716.57
7.4.60.0130.00616.45
7.4.50.0040.00416.68
7.4.40.0120.00616.57
7.4.30.0090.00816.62
7.4.00.0030.01015.18
7.3.330.0000.00613.46
7.3.320.0000.00613.48
7.3.310.0040.00416.44
7.3.300.0070.00016.46
7.3.290.0090.00616.44
7.3.280.0100.00716.45
7.3.270.0070.01017.40
7.3.260.0090.00916.51
7.3.250.0110.01016.54
7.3.240.0040.01216.64
7.3.230.0060.01216.39
7.3.210.0100.01416.67
7.3.200.0090.00819.39
7.3.190.0120.01216.56
7.3.180.0000.01616.44
7.3.170.0120.00316.43
7.3.160.0140.00816.50
7.3.120.0030.01314.98
7.2.330.0070.01016.82
7.2.320.0080.00816.83
7.2.310.0180.00416.48
7.2.300.0160.00616.70
7.2.290.0000.01816.70
7.2.80.0110.00416.57
7.2.60.0120.00316.87
7.2.00.0030.01019.38
7.1.200.0040.00415.75
7.1.100.0060.00618.10
7.1.70.0000.00717.17
7.1.60.0140.01119.46
7.1.50.0130.01316.69
7.1.00.0070.07322.33
7.0.200.0080.00316.83
7.0.140.0070.06021.95
7.0.100.0000.05320.03
7.0.90.0300.04720.09
7.0.80.0330.07719.95
7.0.70.0330.05719.91
7.0.60.0300.08019.96
7.0.50.0400.08020.36
7.0.40.0070.08320.17
7.0.30.0030.09020.04
7.0.20.0070.09020.08
7.0.10.0100.09020.05
7.0.00.0070.10320.14
5.6.280.0070.07021.07
5.6.250.0100.04020.80
5.6.240.0100.08020.73
5.6.230.0100.08020.51
5.6.220.0100.07720.64
5.6.210.0030.07720.59
5.6.200.0030.05720.98
5.6.190.0100.08320.98
5.6.180.0130.08021.16
5.6.170.0130.06021.09
5.6.160.0030.06321.17
5.6.150.0070.05721.05
5.6.140.0170.04321.17
5.6.130.0000.09321.04
5.6.120.0030.09021.17
5.6.110.0130.07321.04
5.6.100.0070.08321.06
5.6.90.0030.07721.07
5.6.80.0070.07020.43
5.6.70.0070.08020.45
5.6.60.0070.08320.50
5.6.50.0100.04320.48
5.6.40.0030.08320.50
5.6.30.0030.06320.57
5.6.20.0030.09020.40
5.6.10.0070.07720.32
5.6.00.0070.06720.40
5.5.380.0170.07320.41
5.5.370.0170.07020.48
5.5.360.0000.09020.37
5.5.350.0130.07720.48
5.5.340.0030.06020.89
5.5.330.0130.08320.89
5.5.320.0170.06320.91
5.5.310.0070.09020.95
5.5.300.0100.08020.83
5.5.290.0070.08320.88
5.5.280.0200.04720.94
5.5.270.0130.08020.95
5.5.260.0170.08020.79
5.5.250.0130.07720.73
5.5.240.0130.07020.05
5.5.230.0000.04720.23
5.5.220.0100.04020.17
5.5.210.0100.07720.27
5.5.200.0070.08020.21
5.5.190.0070.08020.30
5.5.180.0070.04320.11
5.5.160.0000.08020.11
5.5.150.0030.07320.26
5.5.140.0070.07320.17
5.5.130.0270.05320.18
5.5.120.0100.07020.00
5.5.110.0130.08320.17
5.5.100.0000.08020.24
5.5.90.0070.08020.09
5.5.80.0000.05020.16
5.5.70.0230.07720.08
5.5.60.0100.07720.13
5.5.50.0070.07020.20
5.5.40.0000.04320.16
5.5.30.0100.08020.07
5.5.20.0170.05719.95
5.5.10.0070.09020.08
5.5.00.0000.06320.14
5.4.450.0100.05319.16
5.4.440.0130.07019.20
5.4.430.0170.07719.56
5.4.420.0130.06719.22
5.4.410.0070.08019.04
5.4.400.0000.08318.96
5.4.390.0000.04319.21
5.4.380.0030.07718.94
5.4.370.0100.06019.23
5.4.360.0070.07318.91
5.4.350.0030.07319.03
5.4.340.0030.08019.21
5.4.320.0130.07319.07
5.4.310.0130.05718.82
5.4.300.0100.07319.23
5.4.290.0100.05018.88
5.4.280.0030.06719.05
5.4.270.0130.06719.04
5.4.260.0070.06719.16
5.4.250.0030.04719.09
5.4.240.0030.07319.11
5.4.230.0030.09018.89
5.4.220.0100.07018.87
5.4.210.0070.07319.02
5.4.200.0100.07019.04
5.4.190.0030.06719.05
5.4.180.0030.08019.04
5.4.170.0100.07718.84
5.4.160.0070.07319.03
5.4.150.0030.08018.86
5.4.140.0100.04716.49
5.4.130.0030.04716.48
5.4.120.0170.06716.50
5.4.110.0130.07016.49
5.4.100.0170.07016.42
5.4.90.0130.05316.55
5.4.80.0170.06316.51
5.4.70.0100.05716.54
5.4.60.0100.07016.42
5.4.50.0030.06316.42
5.4.40.0070.04016.30
5.4.30.0030.07716.43
5.4.20.0030.05316.49
5.4.10.0070.08016.39
5.4.00.0100.05715.91
5.3.290.0070.07714.61
5.3.280.0170.06714.52
5.3.270.0030.06314.61
5.3.260.0130.06714.59
5.3.250.0100.04014.55
5.3.240.0130.06714.67
5.3.230.0070.06014.59
5.3.220.0100.06714.49
5.3.210.0130.08014.68
5.3.200.0130.06714.68
5.3.190.0070.07714.61
5.3.180.0100.07714.61
5.3.170.0000.07714.65
5.3.160.0030.08014.70
5.3.150.0070.07314.48
5.3.140.0070.07714.69
5.3.130.0000.05714.63
5.3.120.0100.09314.60
5.3.110.0030.04714.46
5.3.100.0100.07314.01
5.3.90.0070.07013.94
5.3.80.0070.03714.11
5.3.70.0100.07014.15
5.3.60.0100.06714.03
5.3.50.0070.07014.00
5.3.40.0070.07014.05
5.3.30.0000.07313.89
5.3.20.0170.05313.71
5.3.10.0070.07013.55
5.3.00.0070.07713.65
5.2.170.0030.06312.37
5.2.160.0100.03712.37
5.2.150.0070.06012.37
5.2.140.0070.05312.37
5.2.130.0070.04712.37
5.2.120.0030.06012.37
5.2.110.0130.05312.37
5.2.100.0100.06012.37
5.2.90.0030.06012.37
5.2.80.0030.03712.37
5.2.70.0070.02712.37
5.2.60.0200.04712.37
5.2.50.0070.06312.37
5.2.40.0070.06312.37
5.2.30.0000.04712.37
5.2.20.0000.06012.37
5.2.10.0070.06312.37
5.2.00.0070.06012.37
5.1.60.0100.06012.37
5.1.50.0100.05012.37
5.1.40.0030.02312.37
5.1.30.0030.04012.37
5.1.20.0030.05012.37
5.1.10.0030.05012.37
5.1.00.0000.05712.37
5.0.50.0000.04312.37
5.0.40.0030.04312.37
5.0.30.0030.05712.37
5.0.20.0130.03712.37
5.0.10.0100.03012.37
5.0.00.0030.06712.37
4.4.90.0030.02312.37
4.4.80.0070.03312.37
4.4.70.0000.03712.37
4.4.60.0070.02712.37
4.4.50.0100.03012.37
4.4.40.0030.03312.37
4.4.30.0070.03312.37
4.4.20.0000.03712.37
4.4.10.0030.01712.37
4.4.00.0030.04712.37
4.3.110.0070.03012.37
4.3.100.0030.02712.37
4.3.90.0030.03712.37
4.3.80.0000.05012.37
4.3.70.0030.02312.37
4.3.60.0100.02712.37
4.3.50.0070.03012.37
4.3.40.0000.05312.37
4.3.30.0000.03712.37
4.3.20.0000.04012.37
4.3.10.0030.02712.37
4.3.00.0000.02012.37

preferences:
43.84 ms | 401 KiB | 5 Q