3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait DataTransferTrait { private function __construct(array $params) { foreach ($params as $key => $value) { $this->{'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))}($value); } } public static function fromParams(array $params) { return new static($params); } public function asArray() { return get_object_vars($this); } public function __call($method, $args) { if (substr($method, 0, 3) == 'set' && property_exists($this, lcfirst(substr($method, 3)))) { $this->{lcfirst(substr($method, 3))} = reset($args); } } } abstract class Command { } class MyCommand extends Command implements DataTransferObject { use DataTransferTrait; private $foo; private $bar; private function setBar($value) { $this->bar = $value; } } $foo = MyCommand::fromParams(array('foo' => 'foo', 'bar' => 'bar')); var_dump($foo);

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.00718.40
8.3.50.0120.00721.95
8.3.40.0000.01418.85
8.3.30.0070.00719.17
8.3.20.0050.00220.20
8.3.10.0040.00421.82
8.3.00.0030.00619.23
8.2.180.0000.01516.50
8.2.170.0070.00722.96
8.2.160.0130.00720.35
8.2.150.0070.00724.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00022.22
8.2.110.0030.00620.47
8.2.100.0040.00718.16
8.2.90.0040.00419.21
8.2.80.0030.00517.97
8.2.70.0030.00517.63
8.2.60.0060.00317.80
8.2.50.0040.00418.07
8.2.40.0030.00519.89
8.2.30.0040.00418.06
8.2.20.0070.00017.71
8.2.10.0040.00417.97
8.2.00.0090.00017.75
8.1.280.0150.00625.92
8.1.270.0040.00421.87
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00923.88
8.1.230.0110.00018.93
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0090.00017.38
8.1.190.0000.00817.22
8.1.180.0030.00618.10
8.1.170.0050.00318.57
8.1.160.0030.00622.01
8.1.150.0000.00718.92
8.1.140.0050.00217.48
8.1.130.0030.00317.85
8.1.120.0040.00417.39
8.1.110.0050.00317.49
8.1.100.0020.00517.54
8.1.90.0040.00417.52
8.1.80.0000.00817.44
8.1.70.0070.00017.37
8.1.60.0030.00917.44
8.1.50.0060.00317.58
8.1.40.0040.00417.49
8.1.30.0080.00017.70
8.1.20.0000.00817.57
8.1.10.0060.00317.46
8.1.00.0070.00017.46
8.0.300.0030.00518.77
8.0.290.0000.00816.75
8.0.280.0030.00318.37
8.0.270.0000.00717.31
8.0.260.0030.00517.29
8.0.250.0000.00816.96
8.0.240.0070.00016.99
8.0.230.0030.00316.88
8.0.220.0070.00016.78
8.0.210.0040.00416.89
8.0.200.0040.00417.02
8.0.190.0030.00616.90
8.0.180.0080.00016.96
8.0.170.0000.00816.97
8.0.160.0070.00017.00
8.0.150.0070.00016.88
8.0.140.0040.00416.85
8.0.130.0050.00013.35
8.0.120.0050.00316.91
8.0.110.0070.00016.83
8.0.100.0070.00016.84
8.0.90.0090.00017.03
8.0.80.0090.01016.94
8.0.70.0060.00316.98
8.0.60.0040.00416.88
8.0.50.0060.00316.80
8.0.30.0100.01217.20
8.0.20.0120.01317.41
8.0.10.0000.00716.85
8.0.00.0070.00916.83
7.4.330.0050.00015.00
7.4.320.0030.00316.57
7.4.300.0000.00616.57
7.4.290.0070.00016.65
7.4.280.0060.00616.52
7.4.270.0000.00816.68
7.4.260.0000.00716.62
7.4.250.0000.00816.48
7.4.240.0040.00416.53
7.4.230.0000.00716.52
7.4.220.0040.01616.73
7.4.210.0030.01016.65
7.4.200.0000.00716.43
7.4.160.0120.00416.58
7.4.150.0180.00617.40
7.4.140.0090.01117.86
7.4.130.0080.01216.53
7.4.120.0080.00916.44
7.4.110.0110.00616.65
7.4.100.0110.00816.72
7.4.90.0030.01516.44
7.4.80.0120.00619.39
7.4.70.0060.01116.54
7.4.60.0110.01016.69
7.4.50.0000.00816.48
7.4.40.0060.01216.45
7.4.30.0060.00916.48
7.4.00.0070.01115.03
7.3.330.0000.00513.17
7.3.320.0030.00313.21
7.3.310.0040.00416.15
7.3.300.0070.00016.22
7.3.290.0070.00716.34
7.3.280.0080.00716.29
7.3.270.0100.00717.40
7.3.260.0120.00616.64
7.3.250.0140.00616.50
7.3.240.0210.00016.45
7.3.230.0070.01016.46
7.3.210.0030.01916.56
7.3.200.0090.01219.39
7.3.190.0180.00016.61
7.3.180.0160.00316.27
7.3.170.0100.01016.33
7.3.160.0060.01016.41
7.3.10.0090.00616.87
7.3.00.0030.00916.83
7.2.330.0060.01216.77
7.2.320.0120.00816.86
7.2.310.0060.01016.65
7.2.300.0120.00616.42
7.2.290.0190.00016.80
7.2.130.0000.01516.96
7.2.120.0080.00417.14
7.2.110.0030.00617.04
7.2.100.0000.01116.68
7.2.90.0060.00916.54
7.2.80.0090.00616.56
7.2.70.0070.00716.75
7.2.60.0050.00816.98
7.2.50.0030.01016.88
7.2.40.0000.01016.69
7.2.30.0040.00817.02
7.2.20.0080.00317.09
7.2.10.0030.00617.04
7.2.00.0060.00618.16
7.1.250.0040.00815.72
7.1.200.0030.01015.41
7.1.100.0030.00918.17
7.1.70.0050.00217.03
7.1.60.0070.01719.32
7.1.50.0090.00316.50
7.1.00.0030.08022.57
7.0.200.0040.00416.68
7.0.140.0000.07722.09
7.0.60.0030.06719.98
7.0.50.0070.03717.88
7.0.40.0170.03020.26
7.0.30.0400.06320.23
7.0.20.0270.07720.21
7.0.10.0070.04320.22
7.0.00.0030.05720.27
5.6.280.0100.06721.17
5.6.210.0070.04020.74
5.6.200.0030.04018.23
5.6.190.0100.07720.41
5.6.180.0170.08320.67
5.6.170.0200.04320.47
5.6.160.0170.07320.61
5.6.150.0130.07018.21
5.6.140.0000.04318.16
5.6.130.0100.08018.13
5.6.120.0000.08320.86
5.6.110.0370.05721.13
5.6.100.0030.08320.97
5.6.90.0030.05021.03
5.6.80.0130.07320.54
5.5.350.0130.03320.43
5.5.340.0100.07717.98
5.5.330.0130.07720.25
5.5.320.0230.06020.31
5.5.310.0370.07020.25
5.5.300.0100.04017.96
5.5.290.0170.03717.96
5.5.280.0070.06020.75
5.5.270.0070.05320.88
5.5.260.0070.04020.78
5.5.250.0030.06320.48
5.5.240.0230.05720.29
5.4.450.0800.06319.47
5.4.440.0670.05319.47
5.4.430.0870.06019.58
5.4.420.0700.00019.45
5.4.410.0670.00019.36
5.4.400.0630.00019.09
5.4.390.0870.00019.02
5.4.380.0670.00019.11
5.4.370.0630.00019.09
5.4.360.0600.00019.06
5.4.350.0630.00019.10
5.4.340.0080.03312.02
5.4.320.0040.03812.52
5.4.310.0050.04512.52
5.4.300.0070.04412.52
5.4.290.0080.04512.51
5.4.280.0050.04612.41
5.4.270.0060.03812.41
5.4.260.0100.03412.41
5.4.250.0060.03812.41
5.4.240.0070.03512.41
5.4.230.0080.04012.40
5.4.220.0070.03512.40
5.4.210.0090.03612.40
5.4.200.0070.03712.40
5.4.190.0050.03812.39
5.4.180.0070.03612.40
5.4.170.0050.04312.40
5.4.160.0050.03812.41
5.4.150.0090.03312.40
5.4.140.0030.04012.08
5.4.130.0090.03412.07
5.4.120.0090.03312.04
5.4.110.0110.04612.03
5.4.100.0120.04312.03
5.4.90.0070.05112.03
5.4.80.0060.04412.03
5.4.70.0080.03712.02
5.4.60.0050.03612.02
5.4.50.0080.04012.02
5.4.40.0090.03712.01
5.4.30.0050.03612.01
5.4.20.0080.03412.01
5.4.10.0020.03912.01
5.4.00.0080.03411.50
5.3.290.0100.03512.80
5.3.280.0070.04012.71
5.3.270.0050.04012.73
5.3.260.0090.03612.72
5.3.250.0070.03612.72
5.3.240.0090.03512.72
5.3.230.0080.03812.71
5.3.220.0060.03812.68
5.3.210.0060.03912.68
5.3.200.0050.03712.68
5.3.190.0070.03612.68
5.3.180.0040.03812.67
5.3.170.0080.03912.67
5.3.160.0060.03712.67
5.3.150.0070.03612.67
5.3.140.0070.03512.66
5.3.130.0070.04612.66
5.3.120.0020.04212.66
5.3.110.0070.03812.66
5.3.100.0010.04112.13
5.3.90.0050.03712.11
5.3.80.0040.03912.09
5.3.70.0040.03712.09
5.3.60.0050.03712.09
5.3.50.0070.03412.03
5.3.40.0050.03612.03
5.3.30.0080.03211.98
5.3.20.0100.03211.77
5.3.10.0030.03811.74
5.3.00.0030.03811.72
5.2.170.0040.0309.22
5.2.160.0050.0289.23
5.2.150.0050.0319.22
5.2.140.0040.0309.22
5.2.130.0030.0309.18
5.2.120.0060.0269.18
5.2.110.0070.0269.19
5.2.100.0030.0309.18
5.2.90.0030.0309.18
5.2.80.0070.0289.18
5.2.70.0060.0359.18
5.2.60.0070.0419.14
5.2.50.0080.0289.11
5.2.40.0060.0279.08
5.2.30.0070.0279.05
5.2.20.0060.0269.04
5.2.10.0050.0278.95
5.2.00.0030.0308.81
5.1.60.0030.0328.09
5.1.50.0050.0248.10
5.1.40.0020.0268.07
5.1.30.0030.0278.42
5.1.20.0050.0258.45
5.1.10.0050.0258.17
5.1.00.0030.0278.17
5.0.50.0020.0226.64
5.0.40.0030.0196.51
5.0.30.0020.0326.31
5.0.20.0020.0206.28
5.0.10.0040.0206.26
5.0.00.0050.0286.25
4.4.90.0020.0154.77
4.4.80.0040.0154.75
4.4.70.0030.0154.75
4.4.60.0030.0154.75
4.4.50.0010.0174.77
4.4.40.0060.0244.70
4.4.30.0030.0174.76
4.4.20.0060.0154.84
4.4.10.0050.0214.84
4.4.00.0020.0254.76
4.3.110.0040.0214.67
4.3.100.0020.0204.66
4.3.90.0050.0134.64
4.3.80.0010.0274.59
4.3.70.0030.0144.63
4.3.60.0050.0134.63
4.3.50.0040.0154.63
4.3.40.0030.0234.54
4.3.30.0020.0163.28
4.3.20.0000.0183.26
4.3.10.0010.0173.22
4.3.00.0170.0277.08

preferences:
46.64 ms | 401 KiB | 5 Q