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 ($this->mutable == true && 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.0030.01418.56
8.3.50.0040.01118.09
8.3.40.0140.00018.84
8.3.30.0130.01018.96
8.3.20.0000.00820.36
8.3.10.0070.00021.77
8.3.00.0040.00419.25
8.2.180.0180.00316.73
8.2.170.0070.00722.96
8.2.160.0070.00720.25
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0000.00826.16
8.2.120.0080.00320.55
8.2.110.0030.00620.38
8.2.100.0090.00317.63
8.2.90.0050.00319.17
8.2.80.0040.00417.97
8.2.70.0030.00617.50
8.2.60.0030.00518.03
8.2.50.0060.00318.07
8.2.40.0080.00417.91
8.2.30.0050.00217.97
8.2.20.0040.00417.61
8.2.10.0080.00018.00
8.2.00.0000.00917.75
8.1.280.0040.01125.92
8.1.270.0040.00422.10
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00323.83
8.1.230.0090.00317.42
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0030.00617.23
8.1.180.0090.00018.10
8.1.170.0000.00818.64
8.1.160.0030.00522.03
8.1.150.0000.00718.91
8.1.140.0030.00617.33
8.1.130.0070.00017.77
8.1.120.0000.00717.50
8.1.110.0000.00817.44
8.1.100.0040.00417.54
8.1.90.0040.00417.45
8.1.80.0040.00417.40
8.1.70.0000.00717.49
8.1.60.0110.00017.64
8.1.50.0030.00617.59
8.1.40.0040.00417.44
8.1.30.0000.00817.68
8.1.20.0040.00417.57
8.1.10.0040.00417.51
8.1.00.0000.00817.51
8.0.300.0000.00818.77
8.0.290.0000.00816.63
8.0.280.0000.00718.46
8.0.270.0040.00417.29
8.0.260.0030.00317.22
8.0.250.0000.00717.02
8.0.240.0000.00716.94
8.0.230.0080.00016.93
8.0.220.0030.00317.00
8.0.210.0070.00016.95
8.0.200.0000.00717.10
8.0.190.0070.00016.92
8.0.180.0040.00416.86
8.0.170.0080.00016.91
8.0.160.0000.00716.89
8.0.150.0040.00416.89
8.0.140.0000.00716.92
8.0.130.0030.00313.33
8.0.120.0000.00716.93
8.0.110.0080.00016.95
8.0.100.0050.00216.87
8.0.90.0050.00317.00
8.0.80.0070.01117.05
8.0.70.0080.00016.96
8.0.60.0000.00716.89
8.0.50.0050.00216.89
8.0.30.0140.00817.18
8.0.20.0180.00617.40
8.0.10.0000.00717.00
8.0.00.0050.01216.66
7.4.330.0000.00515.00
7.4.320.0030.00316.54
7.4.300.0030.00316.52
7.4.290.0030.00316.58
7.4.280.0050.00516.67
7.4.270.0030.00316.61
7.4.260.0040.00416.61
7.4.250.0050.00316.57
7.4.240.0020.00516.48
7.4.230.0000.00716.45
7.4.220.0110.00716.59
7.4.210.0040.01216.49
7.4.200.0000.00816.73
7.4.160.0090.00616.53
7.4.150.0070.01517.40
7.4.140.0070.01217.86
7.4.130.0130.00616.62
7.4.120.0100.00816.46
7.4.110.0150.00916.62
7.4.100.0120.00916.52
7.4.90.0060.01216.40
7.4.80.0140.00619.39
7.4.70.0120.00616.62
7.4.60.0100.00616.61
7.4.50.0040.00416.52
7.4.40.0130.00916.50
7.4.30.0130.00316.51
7.4.00.0000.01314.96
7.3.330.0050.00013.40
7.3.320.0000.00513.41
7.3.310.0030.00316.40
7.3.300.0030.00316.27
7.3.290.0130.00816.35
7.3.280.0120.00416.38
7.3.270.0070.01117.40
7.3.260.0060.01216.61
7.3.250.0070.01016.49
7.3.240.0100.01016.36
7.3.230.0120.00616.46
7.3.210.0000.01516.57
7.3.200.0040.01819.39
7.3.190.0110.01216.47
7.3.180.0050.01116.45
7.3.170.0140.00416.35
7.3.160.0100.00616.52
7.2.330.0090.00916.45
7.2.320.0070.01016.91
7.2.310.0100.00716.46
7.2.300.0060.01116.82
7.2.290.0170.00016.82
7.1.200.0080.00315.86
7.1.70.0050.00916.92
7.1.60.0000.02419.32
7.1.50.0040.01416.84
7.1.00.0000.08022.45
7.0.200.0030.00716.85
7.0.140.0030.07321.96
7.0.60.0000.04320.07
7.0.50.0200.06717.91
7.0.40.0030.06020.15
7.0.30.0400.04020.34
7.0.20.0330.07720.21
7.0.10.0100.07320.15
7.0.00.0030.05020.08
5.6.280.0070.07321.17
5.6.210.0070.03720.78
5.6.200.0030.04018.18
5.6.190.0070.08720.46
5.6.180.0300.08020.52
5.6.170.0400.07320.51
5.6.160.0130.07020.54
5.6.150.0130.07318.18
5.6.140.0070.08018.15
5.6.130.0200.05018.21
5.6.120.0100.03720.89
5.6.110.0100.06721.10
5.6.100.0070.08721.14
5.6.90.0030.05021.04
5.6.80.0030.08320.46
5.5.350.0070.04720.48
5.5.340.0130.07317.95
5.5.330.0070.05720.47
5.5.320.0330.07320.31
5.5.310.0300.09020.31
5.5.300.0100.07317.95
5.5.290.0000.06018.03
5.5.280.0100.07320.98
5.5.270.0000.06720.65
5.5.260.0000.04720.78
5.5.250.0030.04020.70
5.5.240.0200.07720.18
5.4.450.0870.06319.20
5.4.440.0630.06319.61
5.4.430.0200.09719.45
5.4.420.0700.00019.46
5.4.410.0630.00019.31
5.4.400.0630.00019.16
5.4.390.0630.00019.04
5.4.380.0630.00019.24
5.4.370.0600.00019.02
5.4.360.0630.00019.16
5.4.350.0630.00019.11
5.4.340.0040.03612.02
5.4.320.0060.03612.52
5.4.310.0100.04912.52
5.4.300.0070.03512.52
5.4.290.0060.03812.52
5.4.280.0040.03612.41
5.4.270.0090.04012.41
5.4.260.0060.05012.41
5.4.250.0030.04012.41
5.4.240.0070.03412.41
5.4.230.0090.03912.40
5.4.220.0050.04512.41
5.4.210.0040.04712.40
5.4.200.0090.04712.40
5.4.190.0040.05012.40
5.4.180.0040.03812.40
5.4.170.0090.03512.41
5.4.160.0130.03912.41
5.4.150.0040.04312.40
5.4.140.0090.03612.09
5.4.130.0070.04312.07
5.4.120.0080.04212.03
5.4.110.0070.03412.03
5.4.100.0050.03412.03
5.4.90.0040.03812.03
5.4.80.0090.03312.03
5.4.70.0110.03212.02
5.4.60.0040.03512.03
5.4.50.0040.03712.03
5.4.40.0080.03212.02
5.4.30.0040.03712.01
5.4.20.0060.03412.01
5.4.10.0020.03712.01
5.4.00.0050.03611.49
5.3.290.0050.03912.80
5.3.280.0050.03712.71
5.3.270.0030.04112.72
5.3.260.0090.03912.72
5.3.250.0040.04612.72
5.3.240.0060.03612.72
5.3.230.0090.04612.71
5.3.220.0070.04912.68
5.3.210.0110.04212.68
5.3.200.0070.03412.68
5.3.190.0080.04512.68
5.3.180.0020.04012.68
5.3.170.0060.03512.67
5.3.160.0070.03412.67
5.3.150.0070.03612.67
5.3.140.0070.04512.66
5.3.130.0050.05612.66
5.3.120.0040.05712.66
5.3.110.0090.05212.66
5.3.100.0100.04812.13
5.3.90.0050.04212.11
5.3.80.0070.04112.09
5.3.70.0060.04112.10
5.3.60.0050.04212.08
5.3.50.0060.03612.03
5.3.40.0060.04512.03
5.3.30.0080.03311.99
5.3.20.0060.03411.77
5.3.10.0040.03611.74
5.3.00.0040.03711.71
5.2.170.0040.0459.23
5.2.160.0050.0299.23
5.2.150.0050.0339.22
5.2.140.0040.0319.22
5.2.130.0050.0289.18
5.2.120.0030.0299.18
5.2.110.0060.0279.19
5.2.100.0020.0309.18
5.2.90.0020.0319.18
5.2.80.0050.0299.18
5.2.70.0060.0289.18
5.2.60.0030.0319.14
5.2.50.0040.0299.11
5.2.40.0020.0319.09
5.2.30.0040.0309.05
5.2.20.0040.0299.04
5.2.10.0040.0288.95
5.2.00.0050.0288.81
5.1.60.0040.0238.09
5.1.50.0010.0278.10
5.1.40.0030.0248.07
5.1.30.0040.0258.42
5.1.20.0040.0268.44
5.1.10.0070.0238.17
5.1.00.0030.0268.17
5.0.50.0030.0206.64
5.0.40.0030.0196.50
5.0.30.0030.0316.31
5.0.20.0050.0176.28
5.0.10.0030.0196.26
5.0.00.0050.0286.25
4.4.90.0030.0144.77
4.4.80.0020.0154.76
4.4.70.0020.0154.76
4.4.60.0030.0154.76
4.4.50.0020.0164.77
4.4.40.0010.0264.70
4.4.30.0030.0154.76
4.4.20.0060.0174.85
4.4.10.0070.0174.84
4.4.00.0040.0244.75
4.3.110.0050.0134.67
4.3.100.0030.0144.66
4.3.90.0020.0154.63
4.3.80.0020.0244.59
4.3.70.0050.0124.63
4.3.60.0040.0134.63
4.3.50.0020.0164.63
4.3.40.0030.0274.54
4.3.30.0020.0163.28
4.3.20.0020.0153.26
4.3.10.0020.0153.22
4.3.00.0100.0237.21

preferences:
47.15 ms | 400 KiB | 5 Q