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 = true; 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 (isset($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.0100.01018.30
8.3.50.0100.01321.20
8.3.40.0140.00018.84
8.3.30.0110.00319.13
8.3.20.0040.00420.16
8.3.10.0030.00523.53
8.3.00.0000.00819.25
8.2.180.0070.00718.41
8.2.170.0120.00322.96
8.2.160.0070.00720.45
8.2.150.0060.00624.18
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0090.00022.22
8.2.110.0100.00022.29
8.2.100.0090.00317.50
8.2.90.0040.00419.23
8.2.80.0000.00917.97
8.2.70.0060.00317.50
8.2.60.0050.00317.93
8.2.50.0030.00618.07
8.2.40.0110.00018.22
8.2.30.0000.00718.15
8.2.20.0060.00317.72
8.2.10.0030.00618.09
8.2.00.0090.00017.62
8.1.280.0090.00925.92
8.1.270.0060.00322.19
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00323.97
8.1.230.0000.01117.42
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.36
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0000.00918.65
8.1.160.0040.00421.92
8.1.150.0060.00318.82
8.1.140.0040.00417.35
8.1.130.0030.00317.86
8.1.120.0000.00717.34
8.1.110.0080.00017.52
8.1.100.0040.00417.48
8.1.90.0000.00817.51
8.1.80.0040.00417.45
8.1.70.0030.00317.41
8.1.60.0070.00317.50
8.1.50.0040.00417.46
8.1.40.0080.00017.53
8.1.30.0000.00817.69
8.1.20.0030.00517.60
8.1.10.0000.00717.64
8.1.00.0040.00417.62
8.0.300.0040.00418.77
8.0.290.0020.00516.75
8.0.280.0030.00318.52
8.0.270.0080.00017.29
8.0.260.0000.00717.36
8.0.250.0050.00316.87
8.0.240.0000.00717.05
8.0.230.0030.00316.86
8.0.220.0040.00416.91
8.0.210.0040.00416.82
8.0.200.0060.00316.86
8.0.190.0050.00216.91
8.0.180.0000.00716.95
8.0.170.0050.00316.93
8.0.160.0040.00416.93
8.0.150.0030.00316.82
8.0.140.0000.00716.87
8.0.130.0070.00013.31
8.0.120.0040.00416.87
8.0.110.0000.00716.83
8.0.100.0040.00416.80
8.0.90.0070.00016.78
8.0.80.0120.01016.99
8.0.70.0000.00816.78
8.0.60.0050.00316.80
8.0.50.0030.00516.80
8.0.30.0130.01117.16
8.0.20.0100.01117.40
8.0.10.0050.00316.88
8.0.00.0120.01016.95
7.4.330.0000.00615.00
7.4.320.0000.00716.53
7.4.300.0060.00016.58
7.4.290.0050.00316.64
7.4.280.0120.00016.63
7.4.270.0080.00016.49
7.4.260.0040.00416.64
7.4.250.0000.00716.59
7.4.240.0030.00416.51
7.4.230.0040.00416.50
7.4.220.0120.00616.46
7.4.210.0080.01316.66
7.4.200.0030.00616.53
7.4.160.0030.01316.61
7.4.150.0130.01317.40
7.4.140.0110.01117.86
7.4.130.0050.01716.57
7.4.120.0080.00916.58
7.4.110.0160.00316.59
7.4.100.0000.01816.48
7.4.90.0100.00816.52
7.4.80.0090.00919.39
7.4.70.0080.00816.68
7.4.60.0090.00616.52
7.4.50.0080.00016.53
7.4.40.0040.01416.65
7.4.30.0030.01316.34
7.4.00.0040.00814.92
7.3.330.0060.00013.14
7.3.320.0030.00313.25
7.3.310.0030.00316.18
7.3.300.0030.00316.20
7.3.290.0120.00616.39
7.3.280.0060.01016.36
7.3.270.0130.00417.40
7.3.260.0060.01316.52
7.3.250.0080.00916.60
7.3.240.0120.00916.66
7.3.230.0070.01016.39
7.3.210.0110.00716.33
7.3.200.0060.01119.39
7.3.190.0160.00616.44
7.3.180.0080.00816.37
7.3.170.0070.01816.55
7.3.160.0100.00616.64
7.2.330.0160.00016.66
7.2.320.0070.01016.70
7.2.310.0090.00616.84
7.2.300.0110.00616.57
7.2.290.0150.00316.66
7.2.60.0060.00616.84
7.2.50.0030.01016.96
7.1.200.0040.00415.90
7.1.70.0040.00417.13
7.1.60.0060.01519.32
7.1.50.0090.01216.77
7.1.00.0030.07722.37
7.0.200.0060.00316.89
7.0.140.0100.06321.93
7.0.100.0170.07719.96
7.0.90.0270.04319.98
7.0.80.0170.07720.16
7.0.70.0000.05019.94
7.0.60.0030.06020.00
7.0.50.0100.07720.28
7.0.40.0130.07020.09
7.0.30.0030.08320.05
7.0.20.0100.08320.06
7.0.10.0100.07020.14
7.0.00.0070.07019.99
5.6.280.0070.07020.91
5.6.250.0030.05020.71
5.6.240.0100.08020.71
5.6.230.0030.07020.61
5.6.220.0030.09020.51
5.6.210.0070.07720.59
5.6.200.0030.08320.98
5.6.190.0170.06721.01
5.6.180.0030.07321.03
5.6.170.0130.06721.03
5.6.160.0070.04321.12
5.6.150.0000.07321.03
5.6.140.0200.07321.06
5.6.130.0100.08021.10
5.6.120.0070.06721.02
5.6.110.0130.07721.12
5.6.100.0130.07721.02
5.6.90.0030.04721.06
5.6.80.0070.08020.57
5.6.70.0030.08320.44
5.6.60.0030.05720.36
5.6.50.0200.07020.54
5.6.40.0130.06720.48
5.6.30.0100.07020.41
5.6.20.0030.04720.50
5.6.10.0070.04720.34
5.6.00.0070.03720.39
5.5.380.0130.06720.47
5.5.370.0100.05020.56
5.5.360.0100.06720.36
5.5.350.0070.07020.43
5.5.340.0230.06320.95
5.5.330.0170.06720.66
5.5.320.0100.07720.89
5.5.310.0130.07720.89
5.5.300.0130.06720.81
5.5.290.0070.08020.91
5.5.280.0030.05020.92
5.5.270.0000.07320.77
5.5.260.0200.07020.73
5.5.250.0100.07020.72
5.5.240.0130.03720.14
5.5.230.0070.07720.12
5.5.220.0130.07720.30
5.5.210.0100.06720.30
5.5.200.0130.07020.10
5.5.190.0030.05020.27
5.5.180.0130.06720.10
5.5.160.0200.04720.10
5.5.150.0070.07720.15
5.5.140.0100.07720.28
5.5.130.0200.06720.25
5.5.120.0030.06020.23
5.5.110.0030.08320.10
5.5.100.0100.07720.06
5.5.90.0070.07719.96
5.5.80.0070.07719.96
5.5.70.0130.06320.08
5.5.60.0130.06319.91
5.5.50.0070.07720.18
5.5.40.0130.07020.10
5.5.30.0070.07320.09
5.5.20.0000.07020.11
5.5.10.0100.04320.05
5.5.00.0100.07719.99
5.4.450.0070.07019.54
5.4.440.0000.05719.54
5.4.430.0100.06319.36
5.4.420.0100.06719.50
5.4.410.0030.05719.29
5.4.400.0000.07318.88
5.4.390.0100.07719.14
5.4.380.0130.07318.97
5.4.370.0070.07719.14
5.4.360.0070.07719.14
5.4.350.0070.04318.90
5.4.340.0070.07719.18
5.4.320.0070.08019.13
5.4.310.0030.07719.23
5.4.300.0070.07019.14
5.4.290.0030.04318.90
5.4.280.0070.04719.21
5.4.270.0030.07319.24
5.4.260.0100.07019.03
5.4.250.0030.05718.84
5.4.240.0100.07318.89
5.4.230.0130.06719.04
5.4.220.0170.04719.12
5.4.210.0100.06019.09
5.4.200.0070.06019.09
5.4.190.0030.05319.11
5.4.180.0030.06319.09
5.4.170.0100.07319.09
5.4.160.0070.07719.01
5.4.150.0100.03319.07
5.4.140.0070.03316.48
5.4.130.0100.03016.30
5.4.120.0070.03716.24
5.4.110.0030.03716.57
5.4.100.0030.03716.38
5.4.90.0030.03716.33
5.4.80.0000.03716.32
5.4.70.0070.03316.54
5.4.60.0070.03316.34
5.4.50.0100.03016.31
5.4.40.0030.03016.37
5.4.30.0000.03716.48
5.4.20.0100.02716.50
5.4.10.0000.03716.36
5.4.00.0070.02715.93
5.3.290.0000.07014.59
5.3.280.0030.06314.66
5.3.270.0000.05014.75
5.3.260.0130.06714.63
5.3.250.0030.04314.64
5.3.240.0000.04014.60
5.3.230.0000.04714.66
5.3.220.0030.03714.52
5.3.210.0070.03714.64
5.3.200.0070.03714.68
5.3.190.0030.03714.61
5.3.180.0000.04314.49
5.3.170.0000.04014.50
5.3.160.0030.03314.57
5.3.150.0030.03714.58
5.3.140.0000.04014.63
5.3.130.0030.04314.65
5.3.120.0000.04014.57
5.3.110.0070.07314.53
5.3.100.0100.06014.10
5.3.90.0130.06314.09
5.3.80.0100.07013.91
5.3.70.0000.06714.07
5.3.60.0070.05314.07
5.3.50.0070.03713.97
5.3.40.0130.03013.98
5.3.30.0030.03313.98
5.3.20.0030.03713.72
5.3.10.0000.03713.68
5.3.00.0070.03313.71
5.2.170.0070.03312.17
5.2.160.0000.03712.17
5.2.150.0070.03312.17
5.2.140.0030.03012.17
5.2.130.0130.01712.17
5.2.120.0000.03712.17
5.2.110.0030.02712.17
5.2.100.0030.03712.17
5.2.90.0070.02312.17
5.2.80.0000.03012.17
5.2.70.0100.02312.17
5.2.60.0000.04312.17
5.2.50.0000.03312.17
5.2.40.0070.02312.17
5.2.30.0030.02712.17
5.2.20.0030.03012.17
5.2.10.0000.03012.17
5.2.00.0000.03012.17
5.1.60.0000.02712.17
5.1.50.0030.02012.17
5.1.40.0100.01712.17
5.1.30.0030.02312.17
5.1.20.0100.01712.17
5.1.10.0000.02712.17
5.1.00.0000.02712.17
5.0.50.0000.02012.17
5.0.40.0000.02012.17
5.0.30.0000.03012.17
5.0.20.0000.02012.17
5.0.10.0000.02012.17
5.0.00.0000.03012.17
4.4.90.0000.01712.17
4.4.80.0000.01712.17
4.4.70.0000.02312.17
4.4.60.0030.01312.17
4.4.50.0000.01712.17
4.4.40.0000.02312.17
4.4.30.0030.01312.17
4.4.20.0000.01712.17
4.4.10.0030.01312.17
4.4.00.0030.02012.17
4.3.110.0000.01712.17
4.3.100.0000.01312.17
4.3.90.0000.01712.17
4.3.80.0000.02712.17
4.3.70.0000.01312.17
4.3.60.0000.01712.17
4.3.50.0070.01012.17
4.3.40.0070.03312.17
4.3.30.0000.01712.17
4.3.20.0000.01312.17
4.3.10.0000.01712.17
4.3.00.0000.01312.17

preferences:
60.9 ms | 401 KiB | 5 Q