3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Book { private $bookProperties; private $bookMethods; public function __construct(Array $properties = array()) { $this->bookProperties = array(); $this->bookMethods = array(); foreach ($properties as $property => $value) { $this->bookProperties[$property] = $value; } } public function __get($property) { if (!isset($property, $this->bookProperties)) { throw new \Exception('No such property: ' . $property); } else { return $this->bookProperties[$property]; } } public function __set($property, $value) { $this->bookProperties[$property] = $value; } public function addMethod($methodName, $methodCallable) { if (!is_callable($methodCallable)) { throw new InvalidArgumentException('Second parameter must be callable'); } else { $this->bookMethods[$methodName] = $methodCallable; } } public function __call($methodName, Array $args) { if (!isset($methodName, $this->bookMethods)) { throw new \Exception('No such method: ' . $methodName); } else { return call_user_func_array(array($this, $methodName), $args); } } } $book = new Book; $book->title = 'Code Complete'; print $book->title; $book->addMethod('rateBook', function($rating = 0) { $this->rating = $rating; }); $book->rateBook(5); print $book->rating;

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.0570.04780.13
8.3.50.0620.04379.72
8.3.40.0400.02648.36
8.3.30.0450.01348.25
8.3.20.0110.02149.85
8.3.10.0230.01051.52
8.3.00.0200.01051.53
8.2.180.0810.05980.02
8.2.170.0370.02048.47
8.2.160.0360.03649.94
8.2.150.0240.01048.68
8.2.140.0210.01149.85
8.2.130.0140.01148.82
8.2.120.0100.02049.98
8.2.110.0250.01448.86
8.2.100.0130.03647.55
8.2.90.0110.02548.60
8.2.80.0170.02147.00
8.2.70.0200.02047.00
8.2.60.0100.03447.30
8.2.50.0230.01347.13
8.2.40.0170.01750.12
8.2.30.0270.01048.95
8.2.20.0130.02947.32
8.2.10.0070.03047.62
8.2.00.0100.02447.64
8.1.280.0850.03679.61
8.1.270.0320.01951.68
8.1.260.0230.01051.43
8.1.250.0330.01649.98
8.1.240.0130.02051.71
8.1.230.0310.01748.35
8.1.220.0170.01447.04
8.1.210.0180.01546.85
8.1.200.0260.01046.86
8.1.190.0130.02346.85
8.1.180.0260.01146.85
8.1.170.0060.02348.09
8.1.160.0070.02350.11
8.1.150.0170.01348.30
8.1.140.0200.01048.84
8.1.130.0140.01747.05
8.1.120.0070.02446.80
8.1.110.0140.01446.82
8.1.100.0160.01646.66
8.1.90.0170.01446.84
8.1.80.0070.02446.80
8.1.70.0090.01946.81
8.1.60.0190.01346.78
8.1.50.0140.01846.82
8.1.40.0140.01846.73
8.1.30.0160.01646.90
8.1.20.0070.02646.97
8.1.10.0260.02980.55
8.1.00.0140.04580.52
8.0.300.0270.02780.04
8.0.290.0200.03779.75
8.0.280.0170.03481.45
8.0.270.0340.02780.24
8.0.260.0160.03980.38
8.0.250.0270.03079.76
8.0.240.0260.03279.89
8.0.230.0170.03779.89
8.0.220.0270.03079.87
8.0.210.0130.04079.81
8.0.200.0540.02479.85
8.0.190.0320.02979.97
8.0.180.0390.02079.80
8.0.170.0460.04079.74
8.0.160.0310.02779.79
8.0.150.0300.03079.82
8.0.140.0230.03779.71
8.0.130.0430.070136.51
8.0.120.0330.02379.80
8.0.110.0130.04279.73
8.0.100.0200.03979.69
8.0.90.0240.03579.77
8.0.80.0520.07179.93
8.0.70.0160.04379.70
8.0.60.0230.03079.76
8.0.50.0200.03379.80
8.0.30.0600.08280.17
8.0.20.0670.06480.04
8.0.10.0170.03879.82
8.0.00.0600.06979.59
7.4.330.0200.02378.05
7.4.320.0200.03379.36
7.4.300.0230.02779.50
7.4.290.0270.03479.52
7.4.280.0310.03179.46
7.4.270.0130.04679.45
7.4.260.0310.03479.46
7.4.250.0230.03379.48
7.4.240.0280.02579.29
7.4.230.0170.03779.60
7.4.220.0700.07379.55
7.4.210.0460.07279.46
7.4.200.0280.02879.32
7.4.160.0640.06479.41
7.4.150.0620.06679.34
7.4.140.0720.07279.54
7.4.130.0700.05079.41
7.4.120.0610.05979.46
7.4.110.0850.03979.63
7.4.100.0860.09479.54
7.4.90.0550.06879.55
7.4.80.0680.05579.31
7.4.70.0420.08679.69
7.4.60.0660.07979.38
7.4.50.0170.04479.38
7.4.40.0700.04779.50
7.4.30.0600.06779.53
7.4.00.0350.03577.94
7.3.330.0660.040136.47
7.3.320.0400.066136.42
7.3.310.0200.03379.39
7.3.300.0110.04179.45
7.3.290.0280.02879.66
7.3.280.0710.09479.54
7.3.270.0740.05279.60
7.3.260.0900.08479.66
7.3.250.0720.05379.65
7.3.240.0620.06579.60
7.3.230.0930.06979.64
7.3.210.0690.05379.56
7.3.200.0690.05779.79
7.3.190.0570.08179.69
7.3.180.0520.08579.86
7.3.170.0580.06479.67
7.3.160.0660.05479.46
7.3.10.1930.03778.68
7.3.00.1710.04378.31
7.2.330.1020.05780.02
7.2.320.0660.05679.96
7.2.310.0760.04979.73
7.2.300.0640.06080.06
7.2.290.0720.05279.86
7.2.130.1760.05478.66
7.2.120.1550.04578.66
7.2.110.1680.04078.71
7.2.100.1690.04878.84
7.2.90.1750.02078.93
7.2.80.2080.04778.91
7.2.70.2160.02878.49
7.2.60.2160.03378.81
7.2.50.1590.03978.55
7.2.40.1880.04779.03
7.2.30.1030.05278.85
7.2.20.0750.03779.01
7.2.10.0600.05378.99
7.2.00.0910.03879.85
7.1.250.1290.05477.81
7.1.200.1150.02077.80
7.1.100.0490.01222.16
7.1.70.1380.02078.78
7.1.60.0070.07279.27
7.1.50.0520.03378.44
7.1.00.0070.11784.24
7.0.200.4060.03377.98
7.0.60.1770.09383.48
7.0.50.0300.10081.23
7.0.40.0100.07720.26
7.0.30.0270.07020.23
7.0.20.0370.11720.15
7.0.10.0130.06320.15
7.0.00.0170.11020.13
5.6.280.0030.05339.78
5.6.210.0130.07039.16
5.6.200.0100.08736.81
5.6.190.0100.07739.04
5.6.180.0430.07738.86
5.6.170.0230.05339.04
5.6.160.0030.10338.96
5.6.150.0100.04736.64
5.6.140.0130.09036.78
5.6.130.0070.07336.79
5.6.120.0270.06739.55
5.6.110.0070.07739.59
5.6.100.0100.09339.64
5.6.90.0200.08039.75
5.6.80.0170.09039.00
5.5.350.0130.09339.25
5.5.340.0130.09036.76
5.5.330.0200.09039.04
5.5.320.0400.05039.04
5.5.310.0430.08038.97
5.5.300.0170.03736.77
5.5.290.0200.08336.78
5.5.280.0130.04739.74
5.5.270.0170.08339.61
5.5.260.0330.06739.73
5.5.250.0200.09039.63
5.5.240.0170.07739.03

preferences:
59.33 ms | 401 KiB | 5 Q