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 (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.0140.00718.55
8.3.50.0180.00322.01
8.3.40.0090.00618.67
8.3.30.0070.00719.22
8.3.20.0050.00220.16
8.3.10.0040.00421.80
8.3.00.0060.00319.26
8.2.180.0070.00716.32
8.2.170.0030.01722.96
8.2.160.0140.00020.60
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00422.10
8.2.110.0000.01020.57
8.2.100.0040.00817.91
8.2.90.0060.00618.02
8.2.80.0060.00317.97
8.2.70.0040.00717.50
8.2.60.0000.00917.80
8.2.50.0040.00418.07
8.2.40.0080.00318.26
8.2.30.0030.00618.17
8.2.20.0040.00417.63
8.2.10.0050.00218.01
8.2.00.0070.00017.71
8.1.280.0140.00325.92
8.1.270.0090.00022.01
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.05
8.1.230.0110.00020.89
8.1.220.0040.00417.76
8.1.210.0050.00318.96
8.1.200.0060.00617.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.00918.73
8.1.160.0030.00622.00
8.1.150.0060.00318.97
8.1.140.0050.00317.58
8.1.130.0000.00817.77
8.1.120.0000.00717.50
8.1.110.0000.00717.48
8.1.100.0030.00517.47
8.1.90.0050.00317.38
8.1.80.0040.00417.41
8.1.70.0030.00317.39
8.1.60.0000.01017.63
8.1.50.0040.00417.49
8.1.40.0050.00317.54
8.1.30.0060.00317.51
8.1.20.0050.00317.67
8.1.10.0040.00417.47
8.1.00.0060.00317.55
8.0.300.0000.00920.16
8.0.290.0080.00016.75
8.0.280.0040.00418.55
8.0.270.0000.00717.27
8.0.260.0030.00517.20
8.0.250.0070.00017.02
8.0.240.0000.00716.89
8.0.230.0000.00716.87
8.0.220.0000.00716.79
8.0.210.0030.00316.94
8.0.200.0000.00716.98
8.0.190.0060.00317.03
8.0.180.0040.00416.94
8.0.170.0050.00316.81
8.0.160.0030.00316.99
8.0.150.0040.00416.86
8.0.140.0000.00816.89
8.0.130.0000.00513.34
8.0.120.0040.00416.92
8.0.110.0000.00816.75
8.0.100.0040.00416.89
8.0.90.0040.00416.85
8.0.80.0060.01316.90
8.0.70.0000.00816.90
8.0.60.0080.00016.99
8.0.50.0040.00416.93
8.0.30.0120.00817.03
8.0.20.0110.00817.40
8.0.10.0020.00517.11
8.0.00.0090.00816.93
7.4.330.0000.00615.00
7.4.320.0000.00616.59
7.4.300.0000.00616.59
7.4.290.0070.00016.64
7.4.280.0030.00716.63
7.4.270.0020.00516.66
7.4.260.0070.00016.59
7.4.250.0000.00716.60
7.4.240.0020.00516.57
7.4.230.0000.00716.52
7.4.220.0150.00316.68
7.4.210.0070.00716.67
7.4.200.0000.00716.52
7.4.160.0030.01316.40
7.4.150.0060.01317.40
7.4.140.0100.01117.86
7.4.130.0110.00716.53
7.4.120.0090.00916.50
7.4.110.0100.00716.41
7.4.100.0130.00716.60
7.4.90.0090.00916.55
7.4.80.0090.00919.39
7.4.70.0180.00016.54
7.4.60.0060.01016.51
7.4.50.0050.00016.63
7.4.40.0060.01016.53
7.4.30.0100.00716.43
7.4.00.0080.00814.90
7.3.330.0050.00013.33
7.3.320.0000.00613.34
7.3.310.0030.00416.14
7.3.300.0040.00416.28
7.3.290.0070.00716.32
7.3.280.0060.00916.33
7.3.270.0070.01617.40
7.3.260.0090.00916.52
7.3.250.0130.00816.46
7.3.240.0130.01016.68
7.3.230.0030.01316.39
7.3.210.0110.00616.28
7.3.200.0060.01219.39
7.3.190.0060.01616.28
7.3.180.0090.00616.52
7.3.170.0100.00716.56
7.3.160.0110.00416.33
7.3.120.0060.01114.84
7.3.110.0050.01214.88
7.3.100.0100.00315.02
7.3.90.0070.01014.98
7.3.80.0060.00815.00
7.3.70.0020.00914.93
7.3.60.0090.00314.68
7.3.50.0030.01214.86
7.3.40.0110.00314.89
7.3.30.0090.00514.87
7.3.20.0050.00816.52
7.3.10.0080.00816.75
7.3.00.0030.01116.71
7.2.330.0120.00616.76
7.2.320.0120.00616.66
7.2.310.0180.00316.50
7.2.300.0070.01716.82
7.2.290.0160.00316.96
7.2.250.0080.00815.07
7.2.240.0020.01515.14
7.2.230.0050.01115.16
7.2.220.0030.01214.93
7.2.210.0080.00915.21
7.2.200.0110.00515.03
7.2.190.0120.00415.16
7.2.180.0020.01314.96
7.2.170.0080.00715.18
7.2.160.0060.00915.05
7.2.150.0110.00416.89
7.2.140.0060.00916.70
7.2.130.0030.01017.02
7.2.120.0030.01016.83
7.2.110.0030.00716.85
7.2.100.0110.00016.99
7.2.90.0090.00617.02
7.2.80.0070.00316.88
7.2.70.0060.00917.03
7.2.60.0030.01017.04
7.2.50.0110.00717.15
7.2.40.0060.01017.11
7.2.30.0030.01216.94
7.2.20.0070.01017.01
7.2.10.0060.00616.76
7.2.00.0020.01018.05
7.1.330.0050.01115.66
7.1.320.0090.00515.71
7.1.310.0060.00715.83
7.1.300.0050.01215.77
7.1.290.0070.00815.82
7.1.280.0070.00715.76
7.1.270.0040.00715.79
7.1.260.0080.00515.60
7.1.250.0070.00715.54
7.1.240.0090.00315.84
7.1.230.0070.00715.67
7.1.220.0040.01415.84
7.1.210.0000.01315.58
7.1.200.0050.00915.85
7.1.190.0030.01015.71
7.1.180.0070.00715.65
7.1.170.0040.00715.73
7.1.160.0000.01315.86
7.1.150.0000.01715.88
7.1.140.0040.00715.83
7.1.130.0000.00815.95
7.1.120.0100.00015.73
7.1.110.0060.00615.89
7.1.100.0020.01116.82
7.1.90.0040.00715.60
7.1.80.0100.00615.86
7.1.70.0060.00516.36
7.1.60.0110.00917.57
7.1.50.0020.01716.06
7.1.40.0030.00615.57
7.1.30.0000.01115.70
7.1.20.0090.00315.70
7.1.10.0070.00715.91
7.1.00.0100.03419.14
7.0.330.0070.00715.50
7.0.320.0040.01115.40
7.0.310.0090.00015.66
7.0.300.0070.00715.60
7.0.290.0080.00415.33
7.0.280.0000.01515.29
7.0.270.0030.01015.54
7.0.260.0070.00715.48
7.0.250.0070.00715.41
7.0.240.0030.00615.55
7.0.230.0080.00315.18
7.0.220.0000.01415.59
7.0.210.0000.01015.43
7.0.200.0080.00316.02
7.0.190.0000.01415.57
7.0.180.0090.00315.33
7.0.170.0030.00615.21
7.0.160.0040.01115.55
7.0.150.0090.00615.54
7.0.140.0030.04218.70
7.0.130.0070.00315.63
7.0.120.0090.00315.39
7.0.110.0000.01015.26
7.0.100.0070.00715.26
7.0.90.0070.00415.58
7.0.80.0060.00315.52
7.0.70.0120.00315.36
7.0.60.0030.04217.70
7.0.50.0070.04416.61
7.0.40.0100.03016.72
7.0.30.0260.03316.80
7.0.20.0170.04316.81
7.0.10.0080.02316.84
7.0.00.0040.02116.83
5.6.400.0070.00314.22
5.6.390.0040.00414.44
5.6.380.0000.01014.57
5.6.370.0040.01114.37
5.6.360.0130.00314.45
5.6.350.0070.00413.90
5.6.340.0070.00714.30
5.6.330.0100.00314.67
5.6.320.0100.00714.05
5.6.310.0060.00614.41
5.6.300.0050.00814.63
5.6.290.0040.00714.06
5.6.280.0040.03217.62
5.6.270.0100.00314.18
5.6.260.0030.00614.39
5.6.250.0100.00314.50
5.6.240.0070.00714.60
5.6.230.0060.00314.27
5.6.220.0040.01114.46
5.6.210.0080.02317.45
5.6.200.0010.02616.37
5.6.190.0080.04717.63
5.6.180.0160.04017.44
5.6.170.0100.05017.38
5.6.160.0050.04517.39
5.6.150.0060.02316.40
5.6.140.0080.02116.21
5.6.130.0080.04316.39
5.6.120.0030.02817.76
5.6.110.0090.04217.61
5.6.100.0070.04017.85
5.6.90.0030.04417.72
5.6.80.0050.04517.45
5.6.70.0000.01414.50
5.6.60.0060.00314.50
5.6.50.0040.00814.17
5.6.40.0030.01014.24
5.6.30.0040.01114.26
5.6.20.0030.01014.56
5.6.10.0030.00914.21
5.6.00.0090.00014.50
5.5.380.0070.00714.07
5.5.370.0110.00314.19
5.5.360.0060.00314.16
5.5.350.0070.02717.32
5.5.340.0090.03316.27
5.5.330.0020.03617.38
5.5.320.0150.04317.48
5.5.310.0150.04317.47
5.5.300.0070.02316.26
5.5.290.0080.04116.14
5.5.280.0070.04317.62
5.5.270.0070.04417.63
5.5.260.0050.02317.74
5.5.250.0110.04317.61
5.5.240.0120.04417.20
5.5.230.0040.00414.03
5.5.220.0070.00714.41
5.5.210.0090.00614.32
5.5.200.0030.01014.15
5.5.190.0000.01614.39
5.5.180.0080.00314.41
5.5.170.0140.00314.27
5.5.160.0040.00414.27
5.5.150.0030.01014.06
5.5.140.0000.00914.15
5.5.130.0000.00814.09
5.5.120.0080.00413.98
5.5.110.0000.01114.42
5.5.100.0030.00914.07
5.5.90.0030.00614.40
5.5.80.0040.00414.35
5.5.70.0000.01314.38
5.5.60.0030.00714.12
5.5.50.0000.01514.48
5.5.40.0120.00014.42
5.5.30.0120.00014.22
5.5.20.0060.00914.16
5.5.10.0080.00814.00
5.5.00.0090.00614.21
5.4.450.0590.02815.64
5.4.440.0100.02915.79
5.4.430.0070.02815.76
5.4.420.0340.00315.74
5.4.410.0340.00215.67
5.4.400.0310.00315.58
5.4.390.0350.00315.47
5.4.380.0320.00315.49
5.4.370.0370.00015.51
5.4.360.0350.00115.59
5.4.350.0320.00315.55
5.4.340.0050.02011.99
5.4.330.0060.00311.94
5.4.320.0080.01912.23
5.4.310.0070.02412.23
5.4.300.0060.02412.23
5.4.290.0040.02712.23
5.4.280.0040.02112.17
5.4.270.0060.02112.18
5.4.260.0040.02212.18
5.4.250.0050.02212.18
5.4.240.0050.02112.17
5.4.230.0060.02812.17
5.4.220.0030.02412.17
5.4.210.0100.02512.17
5.4.200.0100.02912.17
5.4.190.0040.03012.17
5.4.180.0030.02612.17
5.4.170.0030.02412.18
5.4.160.0050.02112.17
5.4.150.0050.02212.17
5.4.140.0040.02412.01
5.4.130.0060.02512.01
5.4.120.0060.02211.99
5.4.110.0080.02011.98
5.4.100.0060.02011.98
5.4.90.0050.02511.98
5.4.80.0070.02811.98
5.4.70.0070.02711.98
5.4.60.0060.02311.98
5.4.50.0070.02211.98
5.4.40.0060.02111.98
5.4.30.0020.02411.97
5.4.20.0050.02111.98
5.4.10.0020.02511.98
5.4.00.0040.02311.72
5.3.290.0080.04012.80
5.3.280.0050.04612.71
5.3.270.0100.04412.72
5.3.260.0050.04812.72
5.3.250.0070.04912.72
5.3.240.0070.05012.72
5.3.230.0130.04412.71
5.3.220.0060.05112.68
5.3.210.0100.05012.68
5.3.200.0070.05012.68
5.3.190.0100.04512.68
5.3.180.0050.04012.67
5.3.170.0070.03612.67
5.3.160.0080.03512.68
5.3.150.0090.03612.67
5.3.140.0100.03812.66
5.3.130.0030.04412.66
5.3.120.0050.04012.66
5.3.110.0060.04812.66
5.3.100.0090.04712.12
5.3.90.0090.04912.11
5.3.80.0120.04412.10
5.3.70.0080.04712.09
5.3.60.0170.03812.09
5.3.50.0070.04212.03
5.3.40.0070.05012.03
5.3.30.0070.05711.98
5.3.20.0110.04011.77
5.3.10.0050.03811.73
5.3.00.0080.03411.72
5.2.170.0050.0349.22
5.2.160.0060.0289.22
5.2.150.0040.0309.23
5.2.140.0070.0289.22
5.2.130.0070.0369.18
5.2.120.0060.0329.18
5.2.110.0060.0359.19
5.2.100.0030.0359.18
5.2.90.0060.0329.18
5.2.80.0050.0329.18
5.2.70.0050.0309.18
5.2.60.0040.0329.14
5.2.50.0070.0399.11
5.2.40.0060.0359.08
5.2.30.0070.0329.05
5.2.20.0060.0439.04
5.2.10.0040.0528.94
5.2.00.0080.0388.81
5.1.60.0040.0298.09
5.1.50.0060.0368.09
5.1.40.0070.0308.07
5.1.30.0070.0308.42
5.1.20.0030.0318.45
5.1.10.0050.0258.18
5.1.00.0020.0288.18
5.0.50.0040.0216.64
5.0.40.0020.0216.51
5.0.30.0040.0346.31
5.0.20.0060.0246.28
5.0.10.0040.0206.26
5.0.00.0040.0326.25
4.4.90.0050.0204.78
4.4.80.0020.0224.75
4.4.70.0040.0194.75
4.4.60.0040.0194.76
4.4.50.0040.0204.77
4.4.40.0040.0324.71
4.4.30.0060.0184.76
4.4.20.0020.0234.84
4.4.10.0020.0184.85
4.4.00.0040.0284.76
4.3.110.0030.0224.67
4.3.100.0050.0144.66
4.3.90.0030.0154.63
4.3.80.0050.0234.59
4.3.70.0060.0134.63
4.3.60.0060.0224.63
4.3.50.0030.0224.63
4.3.40.0020.0334.53
4.3.30.0060.0263.28
4.3.20.0020.0273.26
4.3.10.0060.0313.22
4.3.00.0030.0237.08

preferences:
58.64 ms | 401 KiB | 5 Q