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. class Foo { public function bar() { var_dump(__METHOD__); } public function baz() { var_dump(__METHOD__); } public function bat() { var_dump(__METHOD__); return 'bat!'; } } class FluentWrapper { private $instance; private $fluentMethods; public function __construct($instance, array $fluentMethods = []) { $this->instance = $instance; $this->fluentMethods = $fluentMethods; } public function __call($name, $args) { $result = call_user_func([$this->instance, $name], $args); return in_array($name, $this->fluentMethods) ? $this : $result; } } class FluentFoo extends FluentWrapper { public function __construct(Foo $foo) { parent::__construct($foo, ['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.0140.00316.50
8.3.50.0100.00522.15
8.3.40.0000.01418.79
8.3.30.0070.00719.21
8.3.20.0050.00320.38
8.3.10.0080.00023.69
8.3.00.0050.00319.08
8.2.180.0210.00016.75
8.2.170.0040.01122.96
8.2.160.0070.00720.53
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.12
8.2.110.0090.00022.24
8.2.100.0110.00617.91
8.2.90.0030.00619.26
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0040.00418.16
8.2.50.0060.00318.07
8.2.40.0070.00320.07
8.2.30.0040.00418.28
8.2.20.0000.00817.76
8.2.10.0000.00718.01
8.2.00.0000.00717.70
8.1.280.0070.01425.92
8.1.270.0030.00722.06
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0080.00023.88
8.1.230.0000.01119.21
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0000.00817.35
8.1.190.0110.00017.22
8.1.180.0050.00318.10
8.1.170.0070.00318.59
8.1.160.0040.00422.02
8.1.150.0000.00718.53
8.1.140.0040.00417.37
8.1.130.0070.00017.82
8.1.120.0030.00517.46
8.1.110.0100.00017.48
8.1.100.0050.00317.51
8.1.90.0000.00817.40
8.1.80.0000.00717.46
8.1.70.0000.00717.36
8.1.60.0040.00417.43
8.1.50.0000.00917.48
8.1.40.0040.00417.42
8.1.30.0030.00617.57
8.1.20.0030.00617.67
8.1.10.0000.00717.48
8.1.00.0060.00317.52
8.0.300.0000.00718.77
8.0.290.0020.00517.05
8.0.280.0000.00718.45
8.0.270.0000.00817.29
8.0.260.0000.00717.19
8.0.250.0060.00317.02
8.0.240.0040.00416.96
8.0.230.0030.00416.90
8.0.220.0000.00816.98
8.0.210.0000.00717.01
8.0.200.0000.00617.07
8.0.190.0060.00316.93
8.0.180.0000.00716.97
8.0.170.0020.00516.99
8.0.160.0000.00716.96
8.0.150.0070.00016.99
8.0.140.0040.00416.89
8.0.130.0000.00613.44
8.0.120.0000.00816.93
8.0.110.0020.00516.96
8.0.100.0030.00516.84
8.0.90.0000.00816.86
8.0.80.0060.01117.02
8.0.70.0070.00017.04
8.0.60.0040.00417.01
8.0.50.0040.00416.91
8.0.30.0110.01116.98
8.0.20.0120.00917.40
8.0.10.0000.00817.01
8.0.00.0130.00516.87
7.4.330.0050.00015.03
7.4.320.0070.00016.64
7.4.300.0030.00316.54
7.4.290.0040.00416.41
7.4.280.0080.00016.62
7.4.270.0000.00716.53
7.4.260.0000.00716.56
7.4.250.0040.00416.34
7.4.240.0040.00316.62
7.4.230.0000.00716.62
7.4.220.0090.00916.67
7.4.210.0080.00716.56
7.4.200.0070.00016.36
7.4.190.0000.00816.48
7.4.160.0160.00616.57
7.4.150.0120.00417.40
7.4.140.0070.01117.86
7.4.130.0070.01016.54
7.4.120.0070.01216.51
7.4.110.0130.00416.47
7.4.100.0100.01016.50
7.4.90.0090.01316.45
7.4.80.0040.01319.39
7.4.70.0100.01316.31
7.4.60.0080.00816.38
7.4.50.0060.00316.50
7.4.40.0190.00716.67
7.4.30.0000.02116.65
7.4.00.0090.00814.91
7.3.330.0000.00513.15
7.3.320.0050.00013.16
7.3.310.0030.00616.13
7.3.300.0030.00316.18
7.3.290.0130.00716.39
7.3.280.0090.01016.34
7.3.270.0140.00917.40
7.3.260.0070.01116.44
7.3.250.0100.00816.51
7.3.240.0070.01516.18
7.3.230.0100.00716.64
7.3.210.0070.01016.37
7.3.200.0090.00919.39
7.3.190.0090.01416.15
7.3.180.0130.00916.54
7.3.170.0060.00916.47
7.3.160.0130.00716.48
7.3.120.0080.00615.06
7.3.110.0000.01515.06
7.3.100.0030.00914.80
7.3.90.0040.00715.01
7.3.80.0040.01114.49
7.3.70.0090.00614.83
7.3.60.0040.00814.68
7.3.50.0040.00414.59
7.3.40.0040.01114.56
7.3.30.0070.01014.94
7.3.20.0040.01516.69
7.3.10.0060.01316.75
7.3.00.0000.01216.70
7.2.330.0120.00616.76
7.2.320.0130.01016.59
7.2.310.0130.00416.59
7.2.300.0100.00616.61
7.2.290.0120.00616.75
7.2.250.0100.00615.13
7.2.240.0000.02015.16
7.2.230.0030.01414.61
7.2.220.0000.01415.34
7.2.210.0040.01115.33
7.2.200.0030.01515.02
7.2.190.0060.00615.09
7.2.180.0030.01215.08
7.2.170.0070.00714.89
7.2.60.0030.01317.09
7.1.330.0070.00715.88
7.1.320.0030.01315.74
7.1.310.0090.00616.02
7.1.300.0060.00615.75
7.1.290.0030.01015.80
7.1.280.0080.00315.93
7.1.270.0060.01215.63
7.1.260.0040.01415.78
7.1.200.0050.00515.80
7.1.70.0090.00917.19
7.1.60.0090.01619.46
7.1.50.0130.00916.99
7.1.00.0030.07722.33
7.0.200.0030.00616.84
7.0.140.0100.06721.95
7.0.60.0100.07720.08
7.0.50.0130.07717.88
7.0.40.0030.04719.96
7.0.30.0370.08020.26
7.0.20.0230.07720.24
7.0.10.0070.04020.25
7.0.00.0000.05020.33
5.6.280.0100.06721.05
5.6.210.0100.08320.58
5.6.200.0170.06718.19
5.6.190.0100.08720.68
5.6.180.0100.09020.34
5.6.170.0300.08020.45
5.6.160.0100.07720.54
5.6.150.0100.03718.16
5.6.140.0230.06718.21
5.6.130.0100.06318.28
5.6.120.0030.08721.19
5.6.110.0070.08021.15
5.6.100.0100.07721.04
5.6.90.0130.07721.11
5.6.80.0000.05320.52
5.5.350.4000.03720.47
5.5.340.0000.06318.09
5.5.330.0000.06320.30
5.5.320.0230.03720.39
5.5.310.0430.08020.35
5.5.300.0030.08017.95
5.5.290.0100.03318.02
5.5.280.0130.05020.91
5.5.270.0070.08020.78
5.5.260.0070.06020.90
5.5.250.0070.07720.60
5.5.240.0170.07020.30
5.4.450.0330.05719.27
5.4.440.0230.07019.50
5.4.430.0700.06019.47
5.4.420.0700.05719.28
5.4.410.0530.06719.52
5.4.400.1030.05719.08
5.4.390.0600.06319.27
5.4.380.0230.05018.46
5.4.370.0230.04318.72
5.4.360.0170.05018.73
5.4.350.0200.05018.62
5.4.340.0170.05318.63
5.4.320.0100.04312.52
5.4.310.0090.04512.52
5.4.300.0080.03612.52
5.4.290.0120.04012.51
5.4.280.0140.03312.41
5.4.270.0180.06312.41
5.4.260.0110.06112.40
5.4.250.0060.04412.41
5.4.240.0070.04112.40
5.4.230.0060.04312.40
5.4.220.0080.03912.40
5.4.210.0070.03812.39
5.4.200.0070.05512.40
5.4.190.0110.05512.39
5.4.180.0090.05212.39
5.4.170.0060.03912.41
5.4.160.0070.05512.41
5.4.150.0100.04512.40
5.4.140.0070.04812.08
5.4.130.0110.04512.07
5.4.120.0120.04912.03
5.4.110.0080.04012.02
5.4.100.0030.04112.02
5.4.90.0070.03812.02
5.4.80.0090.03612.02
5.4.70.0090.04412.02
5.4.60.0070.03912.02
5.4.50.0100.04712.02
5.4.40.0100.06112.01
5.4.30.0100.05312.00
5.4.20.0060.05012.00
5.4.10.0190.05712.00
5.4.00.0090.05511.49
5.3.290.0060.03912.80
5.3.280.0110.05012.71
5.3.270.0120.03912.72
5.3.260.0110.04112.72
5.3.250.0100.04612.72
5.3.240.0060.04312.72
5.3.230.0080.04212.71
5.3.220.0060.04112.68
5.3.210.0090.05512.68
5.3.200.0130.05012.68
5.3.190.0070.04312.68
5.3.180.0090.03612.67
5.3.170.0090.03812.66
5.3.160.0140.05312.67
5.3.150.0100.03912.67
5.3.140.0090.03612.66
5.3.130.0070.04012.66
5.3.120.0090.03712.66
5.3.110.0070.04112.66
5.3.100.0110.03612.13
5.3.90.0100.04212.11
5.3.80.0090.04812.10
5.3.70.0070.05112.10
5.3.60.0100.04212.08
5.3.50.0080.05412.04
5.3.40.0070.04212.03
5.3.30.0080.03711.99
5.3.20.0060.03511.78
5.3.10.0070.03411.74
5.3.00.0070.03611.72
5.2.170.0050.0339.23
5.2.160.0060.0309.22
5.2.150.0080.0449.23
5.2.140.0060.0409.22
5.2.130.0070.0319.18
5.2.120.0060.0309.19
5.2.110.0080.0289.20
5.2.100.0070.0289.19
5.2.90.0030.0329.19
5.2.80.0060.0349.18
5.2.70.0070.0449.18
5.2.60.0060.0339.14
5.2.50.0070.0329.10
5.2.40.0210.0379.08
5.2.30.0030.0479.06
5.2.20.0070.0339.04
5.2.10.0100.0538.95
5.2.00.0060.0618.82
5.1.60.0090.0328.10
5.1.50.0080.0388.09
5.1.40.0080.0328.08
5.1.30.0100.0378.43
5.1.20.0100.0458.45
5.1.10.0080.0398.17
5.1.00.0090.0398.17
5.0.50.0130.0396.65
5.0.40.0100.0256.51
5.0.30.0120.0496.32
5.0.20.0100.0426.29
5.0.10.0100.0366.27
5.0.00.0120.1166.26
4.4.90.0070.0204.78
4.4.80.0040.0174.76
4.4.70.0060.0204.75
4.4.60.0030.0224.75
4.4.50.0030.0284.77
4.4.40.0050.0364.71
4.4.30.0130.0414.76
4.4.20.0060.0504.84
4.4.10.0070.0134.85
4.4.00.0030.0264.76
4.3.110.0030.0174.67
4.3.100.0040.0224.66
4.3.90.0070.0164.64
4.3.80.0020.0294.59
4.3.70.0050.0144.63
4.3.60.0030.0174.63
4.3.50.0050.0194.63
4.3.40.0040.0284.54
4.3.30.0060.0253.30
4.3.20.0030.0173.28
4.3.10.0050.0153.23
4.3.00.0030.0237.56

preferences:
43.81 ms | 401 KiB | 5 Q