3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait DataTransferTrait { private static $mutable; private function __construct(array $params) { foreach ($params as $key => $value) { $this->{'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))}($value); } unset($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(self::$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.0190.00618.30
8.3.50.0070.01421.10
8.3.40.0000.01418.67
8.3.30.0140.00619.09
8.3.20.0050.00220.13
8.3.10.0030.00621.90
8.3.00.0030.00619.25
8.2.180.0030.01316.50
8.2.170.0040.01122.96
8.2.160.0160.00320.35
8.2.150.0120.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0040.00419.36
8.2.110.0090.00022.05
8.2.100.0000.01217.63
8.2.90.0040.00419.22
8.2.80.0000.00917.97
8.2.70.0100.00017.50
8.2.60.0040.00417.77
8.2.50.0000.00818.07
8.2.40.0000.00919.94
8.2.30.0000.00817.95
8.2.20.0040.00417.72
8.2.10.0040.00418.02
8.2.00.0080.00017.75
8.1.280.0100.00725.92
8.1.270.0080.00022.16
8.1.260.0000.00926.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0090.00319.13
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0100.00017.35
8.1.190.0000.00817.25
8.1.180.0040.00418.10
8.1.170.0090.00018.47
8.1.160.0040.00421.96
8.1.150.0070.00018.97
8.1.140.0000.00717.41
8.1.130.0070.00017.85
8.1.120.0040.00417.49
8.1.110.0000.00817.41
8.1.100.0030.00517.44
8.1.90.0030.00617.38
8.1.80.0040.00417.52
8.1.70.0070.00017.42
8.1.60.0000.01117.50
8.1.50.0000.00817.57
8.1.40.0030.00617.52
8.1.30.0030.00617.73
8.1.20.0040.00417.70
8.1.10.0000.00717.48
8.1.00.0080.00017.51
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0070.00018.47
8.0.270.0070.00017.16
8.0.260.0040.00417.24
8.0.250.0030.00316.85
8.0.240.0040.00416.98
8.0.230.0000.00716.94
8.0.220.0030.00316.90
8.0.210.0000.00716.94
8.0.200.0030.00316.84
8.0.190.0040.00416.92
8.0.180.0040.00416.85
8.0.170.0080.00016.95
8.0.160.0040.00416.90
8.0.150.0070.00016.74
8.0.140.0050.00316.90
8.0.130.0060.00013.35
8.0.120.0030.00516.94
8.0.110.0030.00516.76
8.0.100.0040.00416.75
8.0.90.0040.00416.91
8.0.80.0100.00616.82
8.0.70.0040.00416.80
8.0.60.0070.00017.04
8.0.50.0070.00016.93
8.0.30.0100.00817.08
8.0.20.0080.01317.40
8.0.10.0000.00716.99
8.0.00.0080.01016.76
7.4.330.0050.00015.00
7.4.320.0060.00016.55
7.4.300.0030.00316.63
7.4.290.0000.00716.63
7.4.280.0090.00216.42
7.4.270.0000.00716.43
7.4.260.0030.00316.44
7.4.250.0040.00416.35
7.4.240.0030.00416.61
7.4.230.0070.00016.47
7.4.220.0070.01116.65
7.4.210.0120.00616.73
7.4.200.0070.00016.43
7.4.160.0130.00316.56
7.4.150.0070.01117.40
7.4.140.0120.00617.86
7.4.130.0100.01016.48
7.4.120.0080.01316.58
7.4.110.0130.01316.58
7.4.100.0120.00616.65
7.4.90.0150.00416.48
7.4.80.0180.00019.39
7.4.70.0160.00016.55
7.4.60.0120.00616.68
7.4.50.0000.00616.60
7.4.40.0180.00316.58
7.4.30.0040.01916.64
7.4.00.0080.00715.03
7.3.330.0000.00513.28
7.3.320.0030.00313.35
7.3.310.0000.00716.38
7.3.300.0030.00316.32
7.3.290.0120.00316.31
7.3.280.0060.00916.37
7.3.270.0110.00717.40
7.3.260.0030.01516.39
7.3.250.0050.01216.47
7.3.240.0060.01216.46
7.3.230.0130.00416.39
7.3.210.0110.00616.61
7.3.200.0110.00619.39
7.3.190.0060.01216.33
7.3.180.0100.00716.48
7.3.170.0090.00916.57
7.3.160.0060.00916.35
7.3.120.0140.00414.80
7.3.110.0030.01014.84
7.3.100.0030.01315.07
7.3.90.0030.01015.08
7.3.80.0040.01114.76
7.3.70.0110.00715.03
7.3.60.0060.01014.91
7.3.50.0040.01114.86
7.3.40.0080.00414.92
7.3.30.0070.01014.80
7.3.20.0090.00916.56
7.3.10.0060.00916.75
7.3.00.0120.00316.70
7.2.330.0110.00616.69
7.2.320.0140.00816.85
7.2.310.0100.00616.68
7.2.300.0060.01216.82
7.2.290.0000.01716.71
7.2.250.0070.01115.04
7.2.240.0100.00715.03
7.2.230.0080.00815.03
7.2.220.0120.00614.95
7.2.210.0030.01015.02
7.2.200.0030.01315.14
7.2.190.0060.01315.14
7.2.180.0110.00315.26
7.2.170.0040.01115.20
7.2.60.0040.01116.98
7.2.00.0040.00819.27
7.1.330.0030.01015.88
7.1.320.0000.01415.81
7.1.310.0060.00315.70
7.1.300.0060.00316.01
7.1.290.0090.00615.71
7.1.280.0090.00615.55
7.1.270.0000.01015.45
7.1.260.0000.00915.72
7.1.200.0070.00715.91
7.1.100.0000.01718.28
7.1.70.0000.00817.14
7.1.60.0110.01419.32
7.1.50.0060.00616.78
7.1.00.0130.06722.57
7.0.200.0060.00316.85
7.0.140.0030.07322.22
7.0.60.0130.05720.04
7.0.50.0030.08017.87
7.0.40.0070.07020.12
7.0.30.0530.06020.09
7.0.20.0200.08320.08
7.0.10.0000.08020.08
7.0.00.0070.04020.05
5.6.280.0070.07021.15
5.6.210.0030.04320.54
5.6.200.0000.04718.18
5.6.190.0070.04720.63
5.6.180.0200.06720.41
5.6.170.0300.07320.54
5.6.160.0030.07720.46
5.6.150.0100.07718.18
5.6.140.0000.04318.14
5.6.130.0100.07018.16
5.6.120.0170.07720.75
5.6.110.0200.06721.09
5.6.100.0070.05021.00
5.6.90.0000.09320.96
5.6.80.0200.06720.43
5.5.350.0230.03020.54
5.5.340.0100.08017.94
5.5.330.0030.04720.19
5.5.320.0370.07720.20
5.5.310.0200.08020.35
5.5.300.0170.07318.08
5.5.290.0030.04317.96
5.5.280.0170.07720.79
5.5.270.0130.06720.76
5.5.260.0030.04320.66
5.5.250.0100.03720.63
5.5.240.0170.04020.09
5.4.450.0800.06719.16
5.4.440.0170.05319.59
5.4.430.0970.05019.15
5.4.420.0630.00019.45
5.4.410.0630.00019.29
5.4.400.0670.00018.92
5.4.390.0770.00019.13
5.4.380.0630.00019.07
5.4.370.0600.00018.98
5.4.360.0770.00019.07
5.4.350.0670.00019.16
5.4.340.0070.03512.03
5.4.320.0090.06312.52
5.4.310.0090.04612.52
5.4.300.0090.04012.52
5.4.290.0110.04512.52
5.4.280.0070.03512.41
5.4.270.0070.03812.41
5.4.260.0080.05612.41
5.4.250.0060.05612.41
5.4.240.0110.04112.41
5.4.230.0080.03612.40
5.4.220.0060.04012.40
5.4.210.0110.03412.40
5.4.200.0090.03912.40
5.4.190.0070.03912.39
5.4.180.0080.03612.40
5.4.170.0040.03812.41
5.4.160.0050.03712.41
5.4.150.0040.04012.41
5.4.140.0030.04012.09
5.4.130.0100.03812.07
5.4.120.0090.03412.03
5.4.110.0050.03812.02
5.4.100.0090.04312.03
5.4.90.0080.04012.03
5.4.80.0060.04112.03
5.4.70.0100.03612.03
5.4.60.0080.03512.02
5.4.50.0070.03512.02
5.4.40.0080.03512.01
5.4.30.0070.03912.01
5.4.20.0050.04612.01
5.4.10.0060.04612.00
5.4.00.0080.05111.50
5.3.290.0090.05412.80
5.3.280.0100.05012.71
5.3.270.0090.05312.72
5.3.260.0070.03812.71
5.3.250.0050.03812.72
5.3.240.0050.04112.72
5.3.230.0070.03912.71
5.3.220.0080.03812.68
5.3.210.0050.04112.68
5.3.200.0060.03812.68
5.3.190.0060.03712.67
5.3.180.0040.03812.68
5.3.170.0070.03512.67
5.3.160.0090.03312.67
5.3.150.0090.03512.68
5.3.140.0100.04312.66
5.3.130.0050.04212.66
5.3.120.0070.03712.66
5.3.110.0090.04512.66
5.3.100.0100.04012.13
5.3.90.0060.04312.11
5.3.80.0080.03412.10
5.3.70.0030.04012.10
5.3.60.0070.03612.09
5.3.50.0080.03412.03
5.3.40.0100.03812.03
5.3.30.0080.03911.99
5.3.20.0060.03511.77
5.3.10.0050.03511.74
5.3.00.0110.03111.72
5.2.170.0040.0319.22
5.2.160.0070.0279.22
5.2.150.0050.0339.22
5.2.140.0030.0369.22
5.2.130.0070.0269.18
5.2.120.0040.0299.18
5.2.110.0030.0319.19
5.2.100.0060.0379.18
5.2.90.0070.0359.18
5.2.80.0030.0379.18
5.2.70.0070.0319.17
5.2.60.0070.0329.13
5.2.50.0060.0349.11
5.2.40.0070.0289.08
5.2.30.0040.0309.05
5.2.20.0050.0309.04
5.2.10.0020.0348.95
5.2.00.0040.0298.81
5.1.60.0050.0298.10
5.1.50.0040.0258.09
5.1.40.0110.0188.07
5.1.30.0070.0248.42
5.1.20.0040.0278.44
5.1.10.0030.0288.18
5.1.00.0040.0308.17
5.0.50.0020.0236.64
5.0.40.0040.0226.50
5.0.30.0030.0326.31
5.0.20.0030.0206.28
5.0.10.0030.0216.26
5.0.00.0020.0326.25
4.4.90.0040.0144.77
4.4.80.0030.0154.75
4.4.70.0030.0154.75
4.4.60.0020.0174.75
4.4.50.0020.0204.77
4.4.40.0030.0274.70
4.4.30.0030.0154.76
4.4.20.0010.0184.84
4.4.10.0020.0164.85
4.4.00.0030.0264.76
4.3.110.0040.0164.67
4.3.100.0040.0144.66
4.3.90.0040.0144.64
4.3.80.0030.0274.59
4.3.70.0020.0174.63
4.3.60.0010.0204.63
4.3.50.0030.0204.63
4.3.40.0000.0284.54
4.3.30.0010.0173.29
4.3.20.0010.0213.26
4.3.10.0020.0213.22
4.3.00.0130.0237.21

preferences:
39.4 ms | 401 KiB | 5 Q