3v4l.org

run code in 300+ PHP versions simultaneously
<?php // explicit mention of methods that should be fluent // would be preferable to returning $this on null // since a method may very well return null as something // that is expected. interface Something { public function bar(); public function baz(); public function bat(); } interface SomethingFluent extends Something { public function bar(); public function baz(); public function bat(); } class Foo implements Something { public function bar() { var_dump(__METHOD__); } public function baz() { var_dump(__METHOD__); } public function bat() { var_dump(__METHOD__); return 'bat!'; } } class FluentWrapper implements SomethingFluent { private $instance; private $fluentMethods; public function __construct($instance, array $fluentMethods = array()) { $this->instance = $instance; $this->fluentMethods = $fluentMethods; } public function __call($name, $args) { $result = call_user_func(array($this->instance, $name), $args); return in_array($name, $this->fluentMethods) ? $this : $result; } } class FluentFoo extends FluentWrapper { public function __construct(Foo $foo) { parent::__construct($foo, array('bar', 'baz')); } } $foo = new FluentFoo(new Foo()); $bat = $foo ->bar() ->baz() ->bar() ->baz() ->bat(); print $bat."\n";

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.0070.00716.75
8.3.50.0120.00722.04
8.3.40.0040.01118.85
8.3.30.0140.00019.10
8.3.20.0070.00020.33
8.3.10.0060.00323.65
8.3.00.0080.00019.05
8.2.180.0120.00618.54
8.2.170.0040.01122.96
8.2.160.0120.00320.30
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0020.00520.30
8.2.110.0030.00520.48
8.2.100.0040.00917.89
8.2.90.0030.00517.91
8.2.80.0000.00819.14
8.2.70.0040.00417.63
8.2.60.0060.00317.50
8.2.50.0000.00817.50
8.2.40.0030.00617.63
8.2.30.0030.00518.08
8.2.20.0080.00017.66
8.2.10.0050.00218.13
8.2.00.0000.00717.57
8.1.280.0130.00625.92
8.1.270.0090.00023.74
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00020.56
8.1.230.0100.00320.95
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00617.13
8.1.190.0060.00317.10
8.1.180.0040.00418.10
8.1.170.0040.00417.62
8.1.160.0000.00722.03
8.1.150.0040.00418.51
8.1.140.0000.00717.42
8.1.130.0070.00017.70
8.1.120.0070.00017.43
8.1.110.0000.00717.46
8.1.100.0070.00017.37
8.1.90.0000.00717.46
8.1.80.0070.00017.43
8.1.70.0030.00317.23
8.1.60.0030.00617.52
8.1.50.0050.00317.39
8.1.40.0090.00017.44
8.1.30.0050.00317.59
8.1.20.0040.00417.57
8.1.10.0080.00017.39
8.1.00.0000.00817.36
8.0.300.0030.00519.98
8.0.290.0000.00716.58
8.0.280.0000.00718.46
8.0.270.0000.00717.21
8.0.260.0030.00317.26
8.0.250.0040.00416.98
8.0.240.0060.00316.98
8.0.230.0040.00416.82
8.0.220.0050.00216.94
8.0.210.0000.00716.82
8.0.200.0050.00316.88
8.0.190.0080.00016.98
8.0.180.0040.00416.93
8.0.170.0000.00716.89
8.0.160.0040.00416.91
8.0.150.0030.00616.95
8.0.140.0080.00016.85
8.0.130.0030.00313.38
8.0.120.0080.00016.78
8.0.110.0040.00416.92
8.0.100.0040.00416.91
8.0.90.0070.00016.84
8.0.80.0030.01616.94
8.0.70.0000.00816.87
8.0.60.0000.00816.79
8.0.50.0040.00416.79
8.0.30.0060.01317.01
8.0.20.0100.00817.40
8.0.10.0000.00717.05
8.0.00.0110.00716.83
7.4.330.0050.00015.00
7.4.320.0070.00016.56
7.4.300.0030.00316.32
7.4.290.0030.00316.59
7.4.280.0000.00716.45
7.4.270.0030.00616.48
7.4.260.0000.00716.42
7.4.250.0080.00016.36
7.4.240.0040.00416.58
7.4.230.0070.00016.56
7.4.220.0110.00816.65
7.4.210.0060.00816.48
7.4.200.0030.00416.34
7.4.190.0000.00716.61
7.4.160.0140.00716.38
7.4.150.0060.01217.40
7.4.140.0120.00517.86
7.4.130.0130.00616.45
7.4.120.0130.00416.45
7.4.110.0120.00916.53
7.4.100.0170.00016.48
7.4.90.0030.01416.36
7.4.80.0070.01019.39
7.4.70.0060.01316.60
7.4.60.0070.01016.49
7.4.50.0060.00316.14
7.4.40.0130.00316.52
7.4.30.0100.00716.30
7.4.00.0100.00314.99
7.3.330.0050.00013.13
7.3.320.0030.00213.28
7.3.310.0000.00716.10
7.3.300.0000.00716.27
7.3.290.0060.00916.26
7.3.280.0080.00916.27
7.3.270.0120.00617.40
7.3.260.0130.00316.18
7.3.250.0070.01316.37
7.3.240.0090.00916.53
7.3.230.0130.00316.39
7.3.210.0100.00716.20
7.3.200.0060.01219.39
7.3.190.0130.00716.53
7.3.180.0130.00316.55
7.3.170.0120.00616.43
7.3.160.0030.01316.38
7.3.120.0000.01415.00
7.2.330.0060.01216.63
7.2.320.0100.00716.29
7.2.310.0100.00716.43
7.2.300.0030.01216.67
7.2.290.0070.01516.65
7.2.60.0070.00716.73
7.2.00.0060.00319.49
7.1.200.0040.00815.83
7.1.100.0060.00318.02
7.1.70.0000.01517.00
7.1.60.0050.00519.46
7.1.50.0100.01016.31
7.1.00.0000.07722.54
7.0.200.0050.00516.82
7.0.140.0100.06721.96
7.0.60.0100.08319.96
7.0.50.0030.04017.80
7.0.40.0000.04720.09
7.0.30.0200.03720.10
7.0.20.0200.06320.10
7.0.10.0130.06720.30
7.0.00.0100.08020.05
5.6.280.0000.07721.12
5.6.210.0100.06320.71
5.6.200.0100.06718.25
5.6.190.0070.06020.46
5.6.180.0100.05720.64
5.6.170.0300.05020.45
5.6.160.0070.03720.50
5.6.150.0130.07718.19
5.6.140.0130.07318.19
5.6.130.0070.07018.24
5.6.120.0100.06321.06
5.6.110.0100.08021.15
5.6.100.0030.06021.12
5.6.90.0070.08320.99
5.6.80.0070.07720.54
5.5.350.4130.04720.45
5.5.340.0070.04018.09
5.5.330.0030.05320.57
5.5.320.0270.06320.20
5.5.310.0470.07320.27
5.5.300.0000.04717.98
5.5.290.0100.08017.98
5.5.280.0100.05320.95
5.5.270.0030.04020.81
5.5.260.0130.08320.91
5.5.250.0070.08720.80
5.5.240.0000.05320.05
5.4.450.0400.06719.62
5.4.440.0130.05719.50
5.4.430.1230.06019.54
5.4.420.1030.05019.64
5.4.410.0070.06019.51
5.4.400.0200.07018.91
5.4.390.0230.06718.98
5.4.380.0170.05318.75
5.4.370.0100.05318.78
5.4.360.0170.04718.54
5.4.350.0200.04718.79
5.4.340.0170.04718.60
5.4.320.0130.04612.52
5.4.310.0150.04912.52
5.4.300.0120.04612.52
5.4.290.0100.05012.51
5.4.280.0070.04112.41
5.4.270.0160.04912.41
5.4.260.0040.04712.41
5.4.250.0070.04612.41
5.4.240.0060.05112.41
5.4.230.0080.05312.40
5.4.220.0090.04912.40
5.4.210.0090.03612.40
5.4.200.0070.04112.41
5.4.190.0090.03412.40
5.4.180.0060.03712.40
5.4.170.0070.03712.41
5.4.160.0070.04212.41
5.4.150.0090.03812.40
5.4.140.0100.04112.09
5.4.130.0090.04312.07
5.4.120.0160.03612.03
5.4.110.0130.03712.03
5.4.100.0060.03812.03
5.4.90.0220.07512.03
5.4.80.0140.05512.03
5.4.70.0150.05612.02
5.4.60.0110.04612.02
5.4.50.0090.04212.02
5.4.40.0070.04812.01
5.4.30.0100.03912.01
5.4.20.0070.03812.01
5.4.10.0080.03412.01
5.4.00.0080.03511.50
5.3.290.0090.05312.80
5.3.280.0110.03412.71
5.3.270.0070.04112.73
5.3.260.0100.05712.72
5.3.250.0100.03712.72
5.3.240.0070.04112.72
5.3.230.0100.04112.71
5.3.220.0090.03812.68
5.3.210.0100.05312.68
5.3.200.0110.04312.68
5.3.190.0110.05212.68
5.3.180.0120.06212.67
5.3.170.0130.06212.67
5.3.160.0130.03912.67
5.3.150.0100.05512.67
5.3.140.0090.05412.66
5.3.130.0090.05412.66
5.3.120.0120.05112.66
5.3.110.0100.05112.66
5.3.100.0150.03912.14
5.3.90.0110.03912.12
5.3.80.0100.03712.12
5.3.70.0140.05712.11
5.3.60.0100.05612.10
5.3.50.0170.05312.05
5.3.40.0050.04412.05
5.3.30.0060.04312.01
5.3.20.0070.08711.79
5.3.10.0080.04811.75
5.3.00.0100.03311.74
5.2.170.0050.0319.25
5.2.160.0030.0329.25
5.2.150.0060.0359.25
5.2.140.0090.0289.25
5.2.130.0060.0319.21
5.2.120.0070.0299.20
5.2.110.0060.0319.21
5.2.100.0090.0289.20
5.2.90.0150.0609.21
5.2.80.0120.0599.20
5.2.70.0050.0469.20
5.2.60.0080.0429.16
5.2.50.0060.0439.12
5.2.40.0080.0389.10
5.2.30.0070.0439.07
5.2.20.0090.0309.07
5.2.10.0080.0338.97
5.2.00.0080.0368.83
5.1.60.0060.0258.12
5.1.50.0070.0298.11
5.1.40.0090.0258.09
5.1.30.0220.0298.45
5.1.20.0050.0328.46
5.1.10.0040.0298.19
5.1.00.0050.0288.19
5.0.50.0030.0236.66
5.0.40.0040.0216.53
5.0.30.0070.0526.33
5.0.20.0060.0266.30
5.0.10.0060.0276.28
5.0.00.0110.0296.27
4.4.90.0050.0164.77
4.4.80.0040.0214.75
4.4.70.0060.0154.76
4.4.60.0030.0174.76
4.4.50.0020.0184.77
4.4.40.0040.0264.71
4.4.30.0020.0194.76
4.4.20.0170.0514.85
4.4.10.0070.0214.85
4.4.00.0020.0304.76
4.3.110.0040.0184.66
4.3.100.0050.0154.67
4.3.90.0040.0204.63
4.3.80.0030.0254.59
4.3.70.0040.0154.63
4.3.60.0050.0134.63
4.3.50.0060.0144.63
4.3.40.0060.0214.54
4.3.30.0030.0163.28
4.3.20.0040.0143.26
4.3.10.0010.0163.21
4.3.00.0000.0237.12

preferences:
44.23 ms | 401 KiB | 5 Q