3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait DataTransferTrait { private $mutable; private function __construct(array $params) { foreach ($params as $key => $value) { $this->{'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))}($value); } unset($this->mutable); } public static function fromParams(array $params) { return new static($params); } public function asArray() { return get_object_vars($this); } public function __call($method, $args) { if (property_exists($this, $this->mutable) && substr($method, 0, 3) == 'set' && property_exists($this, lcfirst(substr($method, 3)))) { $this->{lcfirst(substr($method, 3))} = reset($args); } } } abstract class Command { } final 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', 'meh' => 'meh')); $foo->setFoo('newfoo'); $foo->setDog('dog'); 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.0170.00318.43
8.3.50.0170.00718.40
8.3.40.0080.00818.79
8.3.30.0100.00319.09
8.3.20.0080.00020.05
8.3.10.0000.00823.53
8.3.00.0060.00319.38
8.2.180.0120.00316.75
8.2.170.0110.00422.96
8.2.160.0110.00420.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0030.00720.36
8.2.110.0000.00820.54
8.2.100.0060.00618.03
8.2.90.0040.00419.09
8.2.80.0030.00517.97
8.2.70.0030.00517.75
8.2.60.0080.00018.04
8.2.50.0080.00318.07
8.2.40.0150.00417.81
8.2.30.0080.00018.05
8.2.20.0000.00717.82
8.2.10.0000.00718.17
8.2.00.0050.00517.79
8.1.280.0100.00725.92
8.1.270.0040.00422.32
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00923.84
8.1.230.0060.00619.29
8.1.220.0080.00017.74
8.1.210.0030.00518.77
8.1.200.0050.00517.35
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0050.00518.78
8.1.160.0070.00021.99
8.1.150.0000.00718.99
8.1.140.0000.00817.53
8.1.130.0000.00717.79
8.1.120.0040.00417.57
8.1.110.0040.00417.52
8.1.100.0040.00417.41
8.1.90.0000.00717.54
8.1.80.0040.00417.54
8.1.70.0030.00317.41
8.1.60.0090.00317.65
8.1.50.0040.00417.48
8.1.40.0000.00817.60
8.1.30.0030.00517.71
8.1.20.0080.00017.55
8.1.10.0080.00017.50
8.1.00.0000.00817.46
8.0.300.0060.00318.77
8.0.290.0070.00017.00
8.0.280.0070.00018.44
8.0.270.0000.00717.32
8.0.260.0060.00017.23
8.0.250.0070.00017.04
8.0.240.0000.00817.03
8.0.230.0070.00017.10
8.0.220.0000.00717.00
8.0.210.0040.00416.93
8.0.200.0000.00717.05
8.0.190.0030.00517.14
8.0.180.0050.00217.05
8.0.170.0000.00917.04
8.0.160.0070.00016.92
8.0.150.0040.00417.00
8.0.140.0000.00716.92
8.0.130.0030.00313.40
8.0.120.0050.00317.00
8.0.110.0050.00316.91
8.0.100.0030.00316.86
8.0.90.0000.00716.89
8.0.80.0160.00016.95
8.0.70.0040.00417.00
8.0.60.0040.00417.05
8.0.50.0040.00416.84
8.0.30.0100.01317.24
8.0.20.0080.01117.40
8.0.10.0000.00717.20
8.0.00.0150.00616.92
7.4.330.0000.00515.00
7.4.320.0030.00316.61
7.4.300.0000.00616.59
7.4.290.0040.00416.65
7.4.280.0040.00816.55
7.4.270.0070.00016.53
7.4.260.0040.00416.55
7.4.250.0070.00016.48
7.4.240.0040.00416.67
7.4.230.0030.00516.66
7.4.220.0200.00316.51
7.4.210.0110.01116.68
7.4.200.0040.00416.38
7.4.160.0130.01016.58
7.4.150.0030.01617.40
7.4.140.0070.01317.86
7.4.130.0100.00716.60
7.4.120.0060.01116.53
7.4.110.0080.00816.67
7.4.100.0150.00416.65
7.4.90.0100.00716.56
7.4.80.0120.00919.39
7.4.70.0100.01016.51
7.4.60.0060.01016.76
7.4.50.0040.00416.64
7.4.40.0150.00916.63
7.4.30.0110.00616.64
7.4.00.0000.01615.09
7.3.330.0000.00513.41
7.3.320.0030.00313.28
7.3.310.0040.00416.42
7.3.300.0000.00716.37
7.3.290.0150.00616.53
7.3.280.0070.01016.41
7.3.270.0200.00017.40
7.3.260.0180.00016.61
7.3.250.0080.01216.42
7.3.240.0110.01116.36
7.3.230.0130.00316.48
7.3.210.0150.00416.51
7.3.200.0030.01519.39
7.3.190.0160.00616.47
7.3.180.0120.00416.34
7.3.170.0090.00916.28
7.3.160.0100.00616.65
7.2.330.0100.00716.58
7.2.320.0100.01016.84
7.2.310.0090.00616.59
7.2.300.0150.00616.88
7.2.290.0070.01016.89
7.2.60.0030.01016.91
7.2.00.0100.00319.29
7.1.200.0080.00315.80
7.1.100.0110.00017.94
7.1.70.0000.01017.20
7.1.60.0000.02419.32
7.1.50.0070.01416.72
7.1.00.0030.07722.32
7.0.200.0070.00316.88
7.0.140.0000.07021.93
7.0.110.0000.08021.66
7.0.100.0070.07021.66
7.0.90.0070.08321.80
7.0.80.0030.08321.60
7.0.70.0000.06721.67
7.0.60.0000.08721.78
7.0.50.0130.07022.12
7.0.40.0070.08320.01
7.0.30.0070.07720.11
7.0.20.0000.08719.91
7.0.10.0030.08320.17
7.0.00.0100.08020.11
5.6.280.0070.07021.17
5.6.260.0030.06320.59
5.6.250.0100.06720.59
5.6.240.0070.07720.54
5.6.230.0130.05720.66
5.6.220.0070.08320.51
5.6.210.0070.07720.60
5.6.200.0030.05021.11
5.6.190.0100.07321.07
5.6.180.0070.08021.23
5.6.170.0000.08720.95
5.6.160.0070.07320.92
5.6.150.0100.06320.95
5.6.140.0100.08020.98
5.6.130.0070.07720.89
5.6.120.0030.08321.11
5.6.110.0000.09021.07
5.6.100.0030.07321.04
5.6.90.0070.08021.09
5.6.80.0030.07320.49
5.6.70.0130.06720.36
5.6.60.0030.05020.28
5.6.50.0030.06720.30
5.6.40.0030.04320.35
5.6.30.0070.07020.25
5.6.20.0100.07020.60
5.6.10.0070.07720.58
5.6.00.0030.08020.44
5.5.380.0070.07720.22
5.5.370.0030.08020.54
5.5.360.0100.07720.52
5.5.350.0030.08320.41
5.5.340.0070.07720.77
5.5.330.0030.08320.75
5.5.320.0000.05720.71
5.5.310.0100.07320.87
5.5.300.0070.07720.74
5.5.290.0000.06020.71
5.5.280.0030.08020.70
5.5.270.0030.08320.70
5.5.260.0100.08320.82
5.5.250.0000.08320.73
5.5.240.0030.07320.07
5.5.230.0030.07320.38
5.5.220.0000.08020.24
5.5.210.0000.08320.21
5.5.200.0130.06020.22
5.5.190.0030.08320.26
5.5.180.0030.07320.21
5.5.160.0000.08320.13
5.5.150.0100.06320.20
5.5.140.0000.08020.25
5.5.130.0030.08020.05
5.5.120.0000.07720.27
5.5.110.0070.07320.26
5.5.100.0030.08020.02
5.5.90.0070.07719.99
5.5.80.0030.08020.01
5.5.70.0030.04719.96
5.5.60.0130.03720.23
5.5.50.0100.06720.09
5.5.40.0030.07720.09
5.5.30.0000.06019.99
5.5.20.0000.07320.00
5.5.10.0030.07320.20
5.5.00.0030.08320.18
5.4.450.0030.07319.49
5.4.440.0030.07719.46
5.4.430.0070.07019.32
5.4.420.0070.08019.55
5.4.410.0030.04319.36
5.4.400.0070.07019.32
5.4.390.0000.07718.99
5.4.380.0000.08319.34
5.4.370.0000.04719.17
5.4.360.0000.08019.24
5.4.350.0100.06719.25
5.4.340.0030.05319.34
5.4.320.0070.07319.19
5.4.310.0070.07319.10
5.4.300.0070.07319.09
5.4.290.0030.07719.09
5.4.280.0070.05019.18
5.4.270.0000.07719.01
5.4.260.0070.07319.18
5.4.250.0100.07319.25
5.4.240.0030.08019.18
5.4.230.0000.05319.18
5.4.220.0000.07719.21
5.4.210.0030.04319.00
5.4.200.0030.07319.00
5.4.190.0070.06719.00
5.4.180.0030.07018.98
5.4.170.0000.04719.32
5.4.160.0000.07319.31
5.4.150.0030.07719.13
5.4.140.0000.07716.35
5.4.130.0070.07016.39
5.4.120.0130.05716.50
5.4.110.0030.06716.63
5.4.100.0030.06716.57
5.4.90.0030.07316.48
5.4.80.0000.07016.60
5.4.70.0100.05716.59
5.4.60.0000.04716.45
5.4.50.0000.07316.48
5.4.40.0130.06316.59
5.4.30.0000.07016.47
5.4.20.0100.05316.49
5.4.10.0030.07016.62
5.4.00.0030.04715.90
5.3.290.0030.05714.63
5.3.280.0100.07014.61
5.3.270.0070.07014.74
5.3.260.0000.07714.68
5.3.250.0000.07714.47
5.3.240.0130.06314.61
5.3.230.0030.07314.73
5.3.220.0030.07314.66
5.3.210.0030.07014.71
5.3.200.0070.07714.80
5.3.190.0000.07314.62
5.3.180.0030.04314.71
5.3.170.0000.07314.70
5.3.160.0000.07014.42
5.3.150.0000.07314.56
5.3.140.0070.06314.55
5.3.130.0030.07714.68
5.3.120.0000.07714.78
5.3.110.0030.07314.51
5.3.100.0070.03714.07
5.3.90.0030.07014.12
5.3.80.0030.07714.03
5.3.70.0030.07714.10
5.3.60.0070.06314.08
5.3.50.0030.06713.96
5.3.40.0000.06713.97
5.3.30.0030.05713.98
5.3.20.0100.03713.71
5.3.10.0000.07313.62
5.3.00.0000.07713.64
5.2.170.0070.05711.28
5.2.160.0000.04011.23
5.2.150.0000.06711.11
5.2.140.0000.06011.14
5.2.130.0000.06011.12
5.2.120.0030.03311.19
5.2.110.0030.03711.23
5.2.100.0000.06011.23
5.2.90.0030.06011.06
5.2.80.0030.06311.22
5.2.70.0100.05711.18
5.2.60.0030.03711.14
5.2.50.0000.04711.25
5.2.40.0000.03711.09
5.2.30.0000.04010.98
5.2.20.0070.06011.11
5.2.10.0030.05310.88
5.2.00.0000.06010.73
5.1.60.0030.03710.64
5.1.50.0000.03710.64
5.1.40.0070.04710.64
5.1.30.0070.05310.64
5.1.20.0030.06010.64
5.1.10.0000.05710.64
5.1.00.0030.05010.64
5.0.50.0070.03310.64
5.0.40.0070.02710.64
5.0.30.0070.05710.64
5.0.20.0030.03710.64
5.0.10.0030.04310.64
5.0.00.0030.06710.64
4.4.90.0000.03010.64
4.4.80.0000.02710.64
4.4.70.0000.03010.64
4.4.60.0030.03010.64
4.4.50.0000.02710.64
4.4.40.0030.05010.64
4.4.30.0000.03710.64
4.4.20.0000.03010.64
4.4.10.0000.03710.64
4.4.00.0070.04310.64
4.3.110.0000.03710.64
4.3.100.0030.03310.64
4.3.90.0030.03010.64
4.3.80.0000.05310.64
4.3.70.0000.01710.64
4.3.60.0000.03310.64
4.3.50.0030.03010.64
4.3.40.0000.05010.64
4.3.30.0030.03310.64
4.3.20.0000.03010.64
4.3.10.0030.02010.64
4.3.00.0000.03310.64

preferences:
44.33 ms | 400 KiB | 5 Q