3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait DataTransferTrait { private function __construct(array $params) { foreach ($params as $key => $value) { $this->{'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))}($value); } } 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.56
8.3.50.0090.01521.22
8.3.40.0120.00318.52
8.3.30.0000.01419.09
8.3.20.0080.00020.39
8.3.10.0030.00521.94
8.3.00.0030.00619.25
8.2.180.0130.00316.88
8.2.170.0070.00722.96
8.2.160.0070.01120.35
8.2.150.0150.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0090.00022.10
8.2.110.0090.00021.11
8.2.100.0080.00317.78
8.2.90.0080.00019.22
8.2.80.0030.00617.97
8.2.70.0040.00417.63
8.2.60.0030.00517.93
8.2.50.0060.00318.07
8.2.40.0030.00719.94
8.2.30.0000.00718.15
8.2.20.0000.00817.59
8.2.10.0040.00418.01
8.2.00.0070.00017.62
8.1.280.0140.00425.92
8.1.270.0040.00422.04
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0070.00321.29
8.1.230.0040.00817.45
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00817.48
8.1.190.0050.00317.36
8.1.180.0030.00618.10
8.1.170.0080.00018.65
8.1.160.0050.00222.04
8.1.150.0030.00618.80
8.1.140.0060.00317.36
8.1.130.0030.00317.91
8.1.120.0080.00017.46
8.1.110.0040.00417.50
8.1.100.0030.00517.50
8.1.90.0030.00617.39
8.1.80.0000.00817.46
8.1.70.0030.00317.48
8.1.60.0040.00717.53
8.1.50.0050.00317.55
8.1.40.0040.00417.54
8.1.30.0000.00817.70
8.1.20.0040.00417.70
8.1.10.0040.00417.51
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0070.00018.34
8.0.270.0000.00717.23
8.0.260.0040.00417.29
8.0.250.0000.00716.96
8.0.240.0030.00517.02
8.0.230.0070.00016.94
8.0.220.0070.00016.84
8.0.210.0000.00716.96
8.0.200.0030.00316.85
8.0.190.0060.00317.00
8.0.180.0040.00417.03
8.0.170.0060.00316.91
8.0.160.0030.00317.02
8.0.150.0040.00416.86
8.0.140.0000.00816.88
8.0.130.0000.00613.31
8.0.120.0040.00416.88
8.0.110.0000.00816.90
8.0.100.0040.00416.98
8.0.90.0030.00516.88
8.0.80.0160.00716.96
8.0.70.0040.00416.88
8.0.60.0000.00716.72
8.0.50.0000.00716.72
8.0.30.0130.00617.14
8.0.20.0110.00917.40
8.0.10.0000.00716.91
8.0.00.0060.01116.73
7.4.330.0060.00015.00
7.4.320.0030.00316.54
7.4.300.0000.00616.62
7.4.290.0040.00416.64
7.4.280.0050.00616.63
7.4.270.0070.00016.65
7.4.260.0000.00816.66
7.4.250.0040.00416.45
7.4.240.0010.00616.54
7.4.230.0040.00416.63
7.4.220.0100.00716.71
7.4.210.0080.00616.48
7.4.200.0050.00216.39
7.4.160.0060.01116.54
7.4.150.0220.00317.40
7.4.140.0070.01117.86
7.4.130.0060.01116.51
7.4.120.0080.01116.59
7.4.110.0120.01216.47
7.4.100.0060.01316.57
7.4.90.0100.00716.54
7.4.80.0190.00619.39
7.4.70.0110.00516.61
7.4.60.0130.00316.54
7.4.50.0040.00416.58
7.4.40.0090.00916.56
7.4.30.0100.00716.65
7.4.00.0100.00614.94
7.3.330.0050.00013.18
7.3.320.0030.00313.34
7.3.310.0000.00716.34
7.3.300.0070.00016.32
7.3.290.0060.00916.29
7.3.280.0090.00816.34
7.3.270.0070.01117.40
7.3.260.0100.00716.29
7.3.250.0070.01216.59
7.3.240.0160.00416.70
7.3.230.0200.00316.40
7.3.210.0170.00016.22
7.3.200.0160.00819.39
7.3.190.0160.00616.44
7.3.180.0090.00916.61
7.3.170.0030.01316.54
7.3.160.0060.01016.74
7.3.120.0100.01014.77
7.3.110.0110.00714.73
7.3.100.0130.00315.04
7.3.90.0060.00915.08
7.3.80.0110.00414.79
7.3.70.0040.00814.91
7.3.60.0040.00814.85
7.3.50.0100.00014.69
7.3.40.0060.00614.91
7.3.30.0060.00314.84
7.3.20.0030.00616.74
7.3.10.0030.00716.86
7.3.00.0080.00416.71
7.2.330.0090.00916.54
7.2.320.0150.00616.45
7.2.310.0060.01316.73
7.2.300.0100.01016.75
7.2.290.0060.01216.49
7.2.250.0040.01515.08
7.2.240.0030.01715.05
7.2.230.0130.00315.26
7.2.220.0070.00714.94
7.2.210.0080.00415.02
7.2.200.0040.00815.12
7.2.190.0100.00314.91
7.2.180.0030.00915.21
7.2.170.0030.00915.13
7.2.80.0000.01216.72
7.2.60.0030.01216.70
7.2.00.0060.00319.49
7.1.330.0030.01015.70
7.1.320.0000.01315.68
7.1.310.0000.01315.54
7.1.300.0040.00415.67
7.1.290.0060.00615.75
7.1.280.0090.00315.78
7.1.270.0060.00615.96
7.1.260.0100.00015.80
7.1.200.0030.00715.65
7.1.100.0030.01018.05
7.1.70.0030.00517.03
7.1.60.0090.01519.32
7.1.50.0060.01516.78
7.1.00.0000.08022.42
7.0.200.0060.00316.88
7.0.140.0000.07722.18
7.0.60.0070.08320.09
7.0.50.0070.08717.88
7.0.40.0130.05719.96
7.0.30.0230.05720.06
7.0.20.0270.04720.16
7.0.10.0370.05720.21
7.0.00.0130.06020.33
5.6.280.0130.06321.15
5.6.210.0030.04020.49
5.6.200.0070.04018.24
5.6.190.0000.05320.48
5.6.180.3530.04020.48
5.6.170.0270.07320.57
5.6.160.0030.06020.44
5.6.150.0030.04018.29
5.6.140.0070.04318.13
5.6.130.0070.04018.11
5.6.120.0030.05721.01
5.6.110.0130.07721.02
5.6.100.0100.07321.15
5.6.90.0070.08020.98
5.6.80.0030.04320.35
5.6.70.4330.04020.52
5.5.350.0170.04320.51
5.5.340.0070.04017.94
5.5.330.0070.05320.21
5.5.320.0300.08020.35
5.5.310.0400.06320.23
5.5.300.0130.07317.94
5.5.290.0130.08017.95
5.5.280.0170.06720.79
5.5.270.0100.08020.78
5.5.260.0070.09020.78
5.5.250.0070.08320.48
5.5.240.0000.04720.30
5.4.450.0930.04719.46
5.4.440.0530.05719.21
5.4.430.0570.05719.61
5.4.420.0630.00019.54
5.4.410.0670.00019.57
5.4.400.0630.00019.17
5.4.390.0630.00019.12
5.4.380.0630.00019.24
5.4.370.0630.00019.13
5.4.360.0600.00019.13
5.4.350.0630.00019.07
5.4.340.0080.03312.03
5.4.320.0060.03612.52
5.4.310.0010.04312.51
5.4.300.0050.03712.52
5.4.290.0060.03912.52
5.4.280.0080.04212.41
5.4.270.0070.04612.41
5.4.260.0080.03612.41
5.4.250.0050.03912.41
5.4.240.0080.03512.41
5.4.230.0060.03812.40
5.4.220.0060.03612.40
5.4.210.0040.04112.40
5.4.200.0060.03712.40
5.4.190.0060.03512.40
5.4.180.0070.04312.40
5.4.170.0090.03412.41
5.4.160.0060.03612.40
5.4.150.0050.03612.41
5.4.140.0050.03812.08
5.4.130.0050.03712.07
5.4.120.0090.03712.03
5.4.110.0090.03612.02
5.4.100.0080.03812.03
5.4.90.0070.03612.03
5.4.80.0010.04212.03
5.4.70.0070.03912.03
5.4.60.0050.04112.02
5.4.50.0100.03612.03
5.4.40.0070.03312.01
5.4.30.0080.03312.01
5.4.20.0090.04012.01
5.4.10.0060.03412.01
5.4.00.0070.03511.50
5.3.290.0040.04112.80
5.3.280.0070.03912.71
5.3.270.0110.03512.72
5.3.260.0060.03912.72
5.3.250.0040.03912.71
5.3.240.0110.03312.72
5.3.230.0070.03612.71
5.3.220.0120.03112.68
5.3.210.0050.04412.68
5.3.200.0060.03812.68
5.3.190.0080.03912.68
5.3.180.0080.03412.68
5.3.170.0060.03912.67
5.3.160.0080.03512.67
5.3.150.0070.03712.67
5.3.140.0060.05112.66
5.3.130.0110.03512.66
5.3.120.0080.03712.66
5.3.110.0060.03912.66
5.3.100.0050.03812.13
5.3.90.0040.03712.11
5.3.80.0070.03512.09
5.3.70.0060.03512.09
5.3.60.0070.03512.08
5.3.50.0080.04112.03
5.3.40.0090.03512.03
5.3.30.0060.03511.99
5.3.20.0060.03611.77
5.3.10.0050.03811.74
5.3.00.0090.03511.72
5.2.170.0090.0389.23
5.2.160.0060.0379.23
5.2.150.0080.0319.23
5.2.140.0050.0359.21
5.2.130.0070.0299.18
5.2.120.0070.0279.18
5.2.110.0050.0289.19
5.2.100.0060.0349.18
5.2.90.0040.0309.18
5.2.80.0080.0279.18
5.2.70.0040.0309.18
5.2.60.0050.0309.14
5.2.50.0040.0309.11
5.2.40.0070.0279.09
5.2.30.0120.0279.05
5.2.20.0030.0309.04
5.2.10.0070.0278.95
5.2.00.0030.0378.81
5.1.60.0040.0248.10
5.1.50.0050.0238.09
5.1.40.0040.0248.08
5.1.30.0020.0288.43
5.1.20.0050.0258.45
5.1.10.0040.0258.18
5.1.00.0020.0308.17
5.0.50.0010.0236.64
5.0.40.0070.0156.50
5.0.30.0060.0346.31
5.0.20.0040.0256.28
5.0.10.0030.0236.26
5.0.00.0040.0306.25
4.4.90.0040.0144.78
4.4.80.0040.0134.76
4.4.70.0040.0144.76
4.4.60.0040.0144.75
4.4.50.0030.0144.77
4.4.40.0030.0244.70
4.4.30.0030.0154.76
4.4.20.0030.0154.85
4.4.10.0010.0164.85
4.4.00.0030.0244.76
4.3.110.0010.0174.66
4.3.100.0030.0144.66
4.3.90.0030.0134.63
4.3.80.0030.0244.59
4.3.70.0010.0154.63
4.3.60.0020.0154.63
4.3.50.0060.0124.63
4.3.40.0030.0224.54
4.3.30.0050.0133.29
4.3.20.0030.0143.26
4.3.10.0010.0153.22
4.3.00.0270.01312.14

preferences:
52.76 ms | 401 KiB | 5 Q