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 { //echo "attempted to create method " . $methodName . " with args: " . var_export($args, true); return call_user_func_array(array($this, $methodName), array($args)); } } } $book = new Book; $book->title = 'Code Complete'; print $book->title; $rateBookFunc = function($rating = 0) { $this->rating = $rating; }; $book->addMethod('rateBook', $rateBookFunc); $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.07780.77
8.3.50.0850.06480.62
8.3.40.0290.04948.45
8.3.30.0460.01648.29
8.3.20.0170.01750.14
8.3.10.0190.01351.63
8.3.00.0160.01651.41
8.2.180.0700.06080.50
8.2.170.0270.04048.88
8.2.160.0360.02650.10
8.2.150.0100.02648.60
8.2.140.0140.02550.02
8.2.130.0070.01849.07
8.2.120.0060.01550.32
8.2.110.0160.02849.07
8.2.100.0330.02347.78
8.2.90.0100.03149.08
8.2.80.0190.02247.50
8.2.70.0240.02047.38
8.2.60.0200.03347.80
8.2.50.0100.03247.50
8.2.40.0240.01450.43
8.2.30.0130.02649.22
8.2.20.0260.01347.42
8.2.10.0190.02247.76
8.2.00.0190.01947.77
8.1.280.0630.06079.88
8.1.270.0330.02951.71
8.1.260.0130.01751.90
8.1.250.0230.00750.21
8.1.240.0340.01751.70
8.1.230.0260.02650.43
8.1.220.0170.01748.34
8.1.210.0160.01647.11
8.1.200.0100.02646.97
8.1.190.0130.01946.97
8.1.180.0100.02446.98
8.1.170.0100.02448.34
8.1.160.0070.02550.31
8.1.150.0170.01448.64
8.1.140.0140.02149.05
8.1.130.0160.01647.17
8.1.120.0070.02546.98
8.1.110.0110.02146.90
8.1.100.0110.02246.97
8.1.90.0100.02247.09
8.1.80.0140.01747.06
8.1.70.0140.01747.06
8.1.60.0070.02747.22
8.1.50.0140.02147.06
8.1.40.0250.00947.09
8.1.30.0070.02747.20
8.1.20.0190.01347.09
8.1.10.0380.02481.18
8.1.00.0200.04381.25
8.0.300.0360.03683.52
8.0.290.0290.03680.25
8.0.280.0230.04081.86
8.0.270.0230.04580.78
8.0.260.0330.03080.79
8.0.250.0200.04280.39
8.0.240.0230.03980.56
8.0.230.0100.05480.36
8.0.220.0180.04680.42
8.0.210.0200.04680.46
8.0.200.0300.05080.48
8.0.190.0270.04180.39
8.0.180.0190.04980.44
8.0.170.0370.05180.36
8.0.160.0370.03180.42
8.0.150.0130.05580.41
8.0.140.0270.04080.36
8.0.130.0330.085136.72
8.0.120.0160.05280.41
8.0.110.0200.04680.24
8.0.100.0350.03580.37
8.0.90.0240.04780.43
8.0.80.0430.08980.36
8.0.70.0230.04780.33
8.0.60.0130.05280.39
8.0.50.0240.03780.39
8.0.30.0560.07480.57
8.0.20.0640.09580.67
8.0.10.0360.02980.48
8.0.00.0580.10080.26
7.4.330.0200.03178.62
7.4.320.0130.04780.04
7.4.300.0200.04379.99
7.4.290.0240.04480.03
7.4.280.0230.04579.95
7.4.270.0260.04080.04
7.4.260.0240.04179.94
7.4.250.0240.04480.03
7.4.240.0380.02879.99
7.4.230.0230.04279.77
7.4.220.0830.09680.01
7.4.210.0630.10080.07
7.4.200.0230.04680.10
7.4.160.0600.07779.98
7.4.150.0500.10080.13
7.4.140.0890.11379.96
7.4.130.0490.10480.00
7.4.120.0750.07880.01
7.4.110.0620.10180.00
7.4.100.0940.13779.96
7.4.90.0600.09079.87
7.4.80.0850.11079.86
7.4.70.0610.09180.05
7.4.60.0710.08879.98
7.4.50.0330.06380.09
7.4.40.0840.06580.06
7.4.30.0730.12679.98
7.4.10.0290.07878.26
7.4.00.0360.06378.21
7.3.330.0470.073136.66
7.3.320.0530.070136.73
7.3.310.0200.04679.90
7.3.300.0100.06079.67
7.3.290.0280.03879.83
7.3.280.0630.10279.85
7.3.270.0790.07679.98
7.3.260.0690.07979.98
7.3.250.0680.08679.96
7.3.240.0740.10779.79
7.3.230.0870.11279.89
7.3.210.0630.08680.04
7.3.200.0590.12279.77
7.3.190.0870.13180.11
7.3.180.0730.08979.77
7.3.170.0960.11579.87
7.3.160.0570.10079.83
7.3.130.0400.10678.27
7.3.120.0340.11178.10
7.3.110.0370.11078.56
7.3.100.0370.05778.38
7.3.90.0330.06278.47
7.3.80.0300.09478.15
7.3.70.0360.07678.38
7.3.60.0430.07978.05
7.3.50.0420.08477.92
7.3.40.0430.07778.42
7.3.30.0450.07178.23
7.3.20.0270.08178.53
7.3.10.0300.06778.90
7.3.00.0200.06979.00
7.2.330.0610.15080.29
7.2.320.0590.14280.11
7.2.310.0860.12980.31
7.2.300.0830.13780.12
7.2.290.0730.12780.39
7.2.260.0460.14478.68
7.2.250.0530.14078.91
7.2.240.0400.09678.82
7.2.230.0230.11378.63
7.2.220.0200.12478.56
7.2.210.0300.11778.77
7.2.200.0400.13978.68
7.2.190.0360.12678.56
7.2.180.0300.11078.81
7.2.170.0390.12278.72
7.2.160.0370.11478.42
7.2.150.0230.11979.13
7.2.140.0270.11178.95
7.2.130.0300.11379.02
7.2.120.0170.11079.20
7.2.110.0400.13779.13
7.2.100.0260.12979.02
7.2.90.0230.10779.41
7.2.80.0300.13779.04
7.2.70.0260.10979.34
7.2.60.1790.09478.93
7.2.50.0170.09379.20
7.2.40.0130.10878.99
7.2.30.0390.11379.30
7.2.20.0340.10879.14
7.2.10.0240.08579.24
7.2.00.0540.09680.06
7.1.330.0070.11077.85
7.1.320.0200.12178.29
7.1.310.0100.11878.03
7.1.300.0070.12578.22
7.1.290.0200.12077.93
7.1.280.0360.11278.08
7.1.270.0200.13877.84
7.1.260.0130.12978.27
7.1.250.0430.11677.92
7.1.240.0230.11178.02
7.1.230.0400.13078.12
7.1.220.0470.12078.15
7.1.210.0170.10478.06
7.1.200.0610.11478.03
7.1.190.0260.12078.10
7.1.180.0160.11978.11
7.1.170.0100.13177.92
7.1.160.0160.10478.15
7.1.150.0280.12477.75
7.1.140.0410.11877.80
7.1.130.0230.11977.96
7.1.120.0290.10078.19
7.1.110.0440.11177.91
7.1.100.0490.06351.07
7.1.90.0320.10078.15
7.1.80.0200.10877.85
7.1.70.0520.10178.68
7.1.60.0230.12878.88
7.1.50.0270.09878.61
7.1.40.0390.10678.05
7.1.30.0340.13478.09
7.1.20.0330.10378.09
7.1.10.0510.08778.09
7.1.00.0170.13581.14
7.0.330.0100.12577.64
7.0.320.0460.10277.81
7.0.310.0200.13177.46
7.0.300.0000.13977.57
7.0.290.2210.09977.70
7.0.280.0130.10077.79
7.0.270.0240.09277.91
7.0.260.0360.10777.75
7.0.250.0300.09377.71
7.0.240.0240.11477.79
7.0.230.0320.09877.75
7.0.220.0140.11277.87
7.0.210.0460.07877.87
7.0.200.2840.10178.08
7.0.190.0390.10277.69
7.0.180.0390.08677.85
7.0.170.0340.10977.77
7.0.160.0390.08577.51
7.0.150.0220.10077.71
7.0.140.0400.07977.84
7.0.130.0570.09977.77
7.0.120.0380.10177.83
7.0.110.0320.12677.59
7.0.100.0270.08477.64
7.0.90.0170.10477.90
7.0.80.0150.10277.83
7.0.70.0300.10077.41
7.0.60.0680.10780.92
7.0.50.0310.10179.66
7.0.40.0170.11817.01
7.0.30.0290.13616.92
7.0.20.0270.14317.09
7.0.10.0150.10816.90
7.0.00.0220.10516.93
5.6.400.0200.01033.40
5.6.390.0160.01333.42
5.6.380.0230.01333.25
5.6.370.0250.01433.33
5.6.360.0120.02233.38
5.6.350.0040.02033.17
5.6.340.0240.02233.24
5.6.330.0330.01233.16
5.6.320.0310.02233.54
5.6.310.0230.0009.27
5.6.300.0280.02233.55
5.6.290.0270.02433.35
5.6.280.0170.02936.56
5.6.270.0260.02333.45
5.6.260.0150.03333.37
5.6.250.0290.01833.11
5.6.240.0210.01333.30
5.6.230.0230.02133.63
5.6.220.0330.01533.18
5.6.210.0190.03436.34
5.6.200.0200.05835.06
5.6.190.0190.05436.26
5.6.180.0300.05136.30
5.6.170.0260.03636.25
5.6.160.0180.03636.30
5.6.150.0180.04835.17
5.6.140.0190.03235.07
5.6.130.0190.05935.09
5.6.120.0150.04236.63
5.6.110.0250.05436.53
5.6.100.0180.04836.48
5.6.90.0130.03636.60
5.6.80.0200.05236.25
5.6.70.0210.01833.18
5.6.60.0340.00833.19
5.6.50.0210.01833.06
5.6.40.0150.02633.39
5.6.30.0220.02233.11
5.6.20.0240.02133.42
5.6.10.0200.02433.28
5.6.00.0310.01133.49
5.5.380.0250.02233.36
5.5.370.0190.02733.51
5.5.360.0230.02333.05
5.5.350.0170.05736.48
5.5.340.0160.05335.26
5.5.330.0180.06236.29
5.5.320.0370.03036.31
5.5.310.0370.04236.24
5.5.300.0200.02935.38
5.5.290.0200.05835.18
5.5.280.0090.05536.76
5.5.270.0100.05436.64
5.5.260.0150.06136.60
5.5.250.0260.02736.48
5.5.240.0200.03236.12
5.5.230.0180.02133.05
5.5.220.0160.03233.50
5.5.210.0350.01033.44
5.5.200.0110.02233.55
5.5.190.0290.01633.20
5.5.180.0290.01033.43
5.5.170.0320.01433.12
5.5.160.0240.02033.61
5.5.150.0260.01133.52
5.5.140.0290.02633.39
5.5.130.0320.01633.31
5.5.120.0270.01833.71
5.5.110.0200.02332.92
5.5.100.0230.02033.20
5.5.90.0210.02133.68
5.5.80.0200.02033.48
5.5.70.0230.01633.39
5.5.60.0210.01933.47
5.5.50.0200.02232.91
5.5.40.0250.01133.47
5.5.30.0220.02633.25
5.5.20.0280.01333.32
5.5.10.0270.01633.20
5.5.00.0280.01733.21

preferences:
38.86 ms | 401 KiB | 5 Q