3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait ImmutableFromParams { 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 { use ImmutableFromParams; } final class MyCommand extends Command implements DataTransferObject { protected $foo; protected $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.0120.00318.55
8.3.50.0090.01321.93
8.3.40.0110.00418.55
8.3.30.0140.00719.09
8.3.20.0050.00220.39
8.3.10.0080.00023.66
8.3.00.0040.00419.01
8.2.180.0110.00416.88
8.2.170.0120.00322.96
8.2.160.0070.01019.04
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0100.00020.51
8.2.110.0060.00320.53
8.2.100.0040.00817.50
8.2.90.0070.00019.10
8.2.80.0050.00317.97
8.2.70.0050.00317.63
8.2.60.0000.00817.93
8.2.50.0000.01018.07
8.2.40.0050.00519.84
8.2.30.0030.00518.03
8.2.20.0000.00717.64
8.2.10.0000.00817.96
8.2.00.0080.00017.75
8.1.280.0100.01025.92
8.1.270.0000.00922.02
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00623.98
8.1.230.0110.00017.48
8.1.220.0050.00317.76
8.1.210.0050.00318.77
8.1.200.0030.00717.23
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0000.00818.51
8.1.160.0000.00822.09
8.1.150.0050.00218.82
8.1.140.0050.00217.47
8.1.130.0030.00317.87
8.1.120.0040.00317.45
8.1.110.0060.00317.55
8.1.100.0000.00717.38
8.1.90.0040.00417.48
8.1.80.0040.00417.40
8.1.70.0050.00317.46
8.1.60.0090.00617.52
8.1.50.0040.00417.50
8.1.40.0040.00417.55
8.1.30.0040.00417.57
8.1.20.0090.00017.69
8.1.10.0040.00417.58
8.1.00.0070.00017.54
8.0.300.0060.00318.77
8.0.290.0070.00016.63
8.0.280.0030.00318.39
8.0.270.0040.00417.29
8.0.260.0070.00017.33
8.0.250.0070.00016.95
8.0.240.0040.00416.98
8.0.230.0030.00316.98
8.0.220.0070.00016.94
8.0.210.0000.00716.93
8.0.200.0000.00716.90
8.0.190.0070.00017.04
8.0.180.0030.00616.95
8.0.170.0000.00816.83
8.0.160.0070.00016.98
8.0.150.0000.00716.82
8.0.140.0070.00016.91
8.0.130.0000.00613.31
8.0.120.0000.00716.89
8.0.110.0040.00416.82
8.0.100.0050.00316.81
8.0.90.0040.00416.88
8.0.80.0040.01916.88
8.0.70.0030.00616.79
8.0.60.0080.00016.79
8.0.50.0000.00817.04
8.0.30.0130.01017.07
8.0.20.0110.01217.40
8.0.10.0000.00917.16
8.0.00.0070.01016.61
7.4.330.0000.00515.00
7.4.320.0000.00716.49
7.4.300.0000.00616.63
7.4.290.0000.00716.68
7.4.280.0070.00616.62
7.4.270.0030.00316.62
7.4.260.0080.00016.42
7.4.250.0080.00016.60
7.4.240.0040.00416.52
7.4.230.0080.00016.45
7.4.220.0090.00916.71
7.4.210.0110.00716.54
7.4.200.0030.00616.70
7.4.160.0070.01016.45
7.4.150.0100.00917.40
7.4.140.0100.00917.86
7.4.130.0120.00616.69
7.4.120.0100.01116.59
7.4.110.0030.01916.51
7.4.100.0110.00716.64
7.4.90.0070.01016.67
7.4.80.0130.00719.39
7.4.70.0110.00516.45
7.4.60.0060.00916.48
7.4.50.0040.00416.41
7.4.40.0100.00716.69
7.4.30.0080.00816.45
7.4.10.0040.01414.88
7.4.00.0070.00715.00
7.3.330.0000.00613.09
7.3.320.0030.00213.35
7.3.310.0030.00416.43
7.3.300.0000.00716.34
7.3.290.0070.01316.26
7.3.280.0100.00616.34
7.3.270.0150.00817.40
7.3.260.0090.01516.43
7.3.250.0130.00616.37
7.3.240.0090.00916.63
7.3.230.0060.01216.54
7.3.210.0220.00016.58
7.3.200.0070.01419.39
7.3.190.0130.01016.39
7.3.180.0100.00616.43
7.3.170.0150.00616.68
7.3.160.0000.01616.55
7.3.130.0030.01315.06
7.3.120.0120.00714.91
7.3.110.0080.01114.78
7.3.100.0080.00714.75
7.3.90.0080.00614.67
7.3.80.0050.01014.78
7.3.70.0070.00514.83
7.3.60.0020.00914.88
7.3.50.0050.00914.83
7.3.40.0060.00314.82
7.3.30.0090.00614.93
7.3.20.0040.00816.74
7.3.10.0090.00416.50
7.3.00.0050.00916.53
7.2.330.0110.00616.86
7.2.320.0000.01716.82
7.2.310.0120.00616.74
7.2.300.0130.00416.84
7.2.290.0130.00316.66
7.2.260.0030.01714.99
7.2.250.0020.01614.93
7.2.240.0090.00914.96
7.2.230.0080.00715.04
7.2.220.0070.00414.99
7.2.210.0050.01115.21
7.2.200.0090.00315.09
7.2.190.0060.00915.23
7.2.180.0060.00315.20
7.2.170.0080.00815.19
7.2.160.0120.00315.00
7.2.150.0000.01216.95
7.2.140.0080.00517.07
7.2.130.0130.00316.91
7.2.120.0060.00617.14
7.2.110.0000.01316.70
7.2.100.0060.00616.94
7.2.90.0030.01316.80
7.2.80.0000.01016.74
7.2.70.0030.01017.15
7.2.60.0100.00616.67
7.2.50.0110.00316.73
7.2.40.0140.00016.73
7.2.30.0040.01517.04
7.2.20.0100.01016.95
7.2.10.0070.01116.75
7.2.00.0020.00818.20
7.1.330.0060.00915.84
7.1.320.0010.01415.85
7.1.310.0010.00715.89
7.1.300.0050.00815.80
7.1.290.0040.00615.77
7.1.280.0060.00815.71
7.1.270.0060.00615.96
7.1.260.0030.00915.75
7.1.250.0000.01615.61
7.1.240.0000.01416.02
7.1.230.0030.00615.77
7.1.220.0030.00915.83
7.1.210.0080.00415.54
7.1.200.0070.00715.62
7.1.190.0090.00015.53
7.1.180.0090.00615.78
7.1.170.0070.00315.73
7.1.160.0050.00715.68
7.1.150.0120.00615.59
7.1.140.0080.00815.91
7.1.130.0040.01215.67
7.1.120.0090.00615.65
7.1.110.0100.00315.66
7.1.100.0050.00716.80
7.1.90.0060.00915.59
7.1.80.0000.01316.00
7.1.70.0000.01116.44
7.1.60.0050.01517.46
7.1.50.0050.01116.25
7.1.40.0050.01115.98
7.1.30.0060.00315.53
7.1.20.0060.00315.69
7.1.10.0030.00615.75
7.1.00.0080.03119.03
7.0.330.0060.00915.54
7.0.320.0000.01015.45
7.0.310.0030.01015.57
7.0.300.0130.00315.48
7.0.290.0070.01015.38
7.0.280.0110.00615.57
7.0.270.0040.00915.39
7.0.260.0100.00315.35
7.0.250.0040.00415.61
7.0.240.0060.00915.61
7.0.230.0000.01115.36
7.0.220.0090.00315.52
7.0.210.0000.01015.34
7.0.200.0030.00616.21
7.0.190.0040.01115.46
7.0.180.0030.00715.35
7.0.170.0120.00315.50
7.0.160.0090.00315.51
7.0.150.0080.00315.36
7.0.140.0060.04118.77
7.0.130.0000.00915.59
7.0.120.0000.01015.57
7.0.110.0070.00715.23
7.0.100.0060.00615.47
7.0.90.0030.00615.49
7.0.80.0030.00715.41
7.0.70.0050.00415.09
7.0.60.0020.02717.62
7.0.50.0070.04716.56
7.0.40.0100.04516.94
7.0.30.0230.02616.80
7.0.20.0130.02416.87
7.0.10.0020.03616.82
7.0.00.0020.02816.84
5.6.400.0130.00014.57
5.6.390.0090.00314.41
5.6.380.0060.00314.85
5.6.370.0030.00714.58
5.6.360.0070.01114.43
5.6.350.0080.00414.74
5.6.340.0100.00714.21
5.6.330.0100.00714.53
5.6.320.0070.00714.42
5.6.310.0040.00814.25
5.6.300.0030.01014.32
5.6.290.0080.00014.66
5.6.280.0030.04017.51
5.6.270.0030.00814.38
5.6.260.0090.00614.65
5.6.250.0090.00014.58
5.6.240.0070.01014.27
5.6.230.0040.00814.41
5.6.220.0070.00714.40
5.6.210.0030.02417.48
5.6.200.0020.03716.22
5.6.190.0050.04917.60
5.6.180.0180.03217.26
5.6.170.0230.04017.46
5.6.160.0090.04317.58
5.6.150.0070.02716.20
5.6.140.0080.04116.49
5.6.130.0030.02616.30
5.6.120.0070.04817.71
5.6.110.0080.04317.76
5.6.100.0070.04717.65
5.6.90.0030.04917.84
5.6.80.0050.02517.47
5.6.70.0040.00714.27
5.6.60.0030.00614.21
5.6.50.0120.00414.29
5.6.40.0050.00514.44
5.6.30.0000.00814.44
5.6.20.0070.00714.38
5.6.10.0030.00714.36
5.6.00.0100.00013.99
5.5.380.0080.00314.35
5.5.370.0000.01114.49
5.5.360.0060.00614.41
5.5.350.0120.04417.32
5.5.340.0100.03316.24
5.5.330.0060.03317.49
5.5.320.0230.04017.30
5.5.310.0150.04117.22
5.5.300.0120.03716.12
5.5.290.0050.02816.08
5.5.280.0030.04817.71
5.5.270.0070.04517.54
5.5.260.0030.02517.33
5.5.250.0060.02217.42
5.5.240.0120.03117.33
5.5.230.0030.00714.24
5.5.220.0100.00314.50
5.5.210.0000.01114.22
5.5.200.0070.00714.33
5.5.190.0000.01414.50
5.5.180.0100.00314.36
5.5.170.0000.00814.32
5.5.160.0140.00314.46
5.5.150.0060.00614.16
5.5.140.0090.00914.24
5.5.130.0100.01014.08
5.5.120.0030.01714.30
5.5.110.0040.01114.19
5.5.100.0060.00914.15
5.5.90.0120.00313.89
5.5.80.0070.00714.16
5.5.70.0040.01414.55
5.5.60.0090.00614.33
5.5.50.0060.00314.41
5.5.40.0100.00314.36
5.5.30.0090.00613.86
5.5.20.0070.00713.94
5.5.10.0040.01114.05
5.5.00.0060.00613.98
5.4.450.0470.03215.47
5.4.440.0480.02715.21
5.4.430.0430.03215.28
5.4.420.0370.00015.32
5.4.410.0350.00315.27
5.4.400.0330.00314.91
5.4.390.0320.00315.03
5.4.380.0380.00314.92
5.4.370.0400.00015.05
5.4.360.0450.00415.20
5.4.350.0350.00315.17
5.4.340.0070.01911.40
5.4.330.0000.01210.86
5.4.320.0060.02111.81
5.4.310.0060.03011.80
5.4.300.0090.02711.86
5.4.290.0080.02711.80
5.4.280.0060.02211.77
5.4.270.0020.02511.75
5.4.260.0060.02511.63
5.4.250.0060.02211.88
5.4.240.0050.02211.67
5.4.230.0050.02211.60
5.4.220.0090.01611.78
5.4.210.0040.02211.67
5.4.200.0050.02211.54
5.4.190.0090.01911.57
5.4.180.0060.01811.65
5.4.170.0020.02411.80
5.4.160.0070.02111.65
5.4.150.0050.02011.71
5.4.140.0070.01811.48
5.4.130.0030.02211.70
5.4.120.0050.02111.61
5.4.110.0060.01811.53
5.4.100.0050.02311.67
5.4.90.0090.02211.47
5.4.80.0030.02511.43
5.4.70.0040.02311.46
5.4.60.0100.01611.61
5.4.50.0060.02111.46
5.4.40.0050.02311.62
5.4.30.0060.02511.43
5.4.20.0020.02611.49
5.4.10.0060.02011.62
5.4.00.0040.02311.12
5.3.290.0040.04112.80
5.3.280.0090.03412.71
5.3.270.0040.04112.72
5.3.260.0080.03812.72
5.3.250.0060.03712.72
5.3.240.0050.04012.72
5.3.230.0100.03512.71
5.3.220.0080.03912.68
5.3.210.0120.04312.68
5.3.200.0050.04212.68
5.3.190.0080.03712.68
5.3.180.0120.03512.68
5.3.170.0120.04312.67
5.3.160.0120.05012.67
5.3.150.0120.05412.67
5.3.140.0110.05012.66
5.3.130.0170.09712.66
5.3.120.0240.11012.66
5.3.110.0300.09712.66
5.3.100.0110.04712.13
5.3.90.0060.04512.11
5.3.80.0070.04612.09
5.3.70.0070.04012.10
5.3.60.0070.04012.08
5.3.50.0060.04912.03
5.3.40.0210.07112.03
5.3.30.0140.05311.99
5.3.20.0100.06211.77
5.3.10.0080.05411.74
5.3.00.0130.05211.72
5.2.170.0060.0499.23
5.2.160.0070.0459.23
5.2.150.0080.0329.22
5.2.140.0070.0329.21
5.2.130.0050.0369.18
5.2.120.0050.0349.18
5.2.110.0070.0349.19
5.2.100.0060.0279.18
5.2.90.0040.0339.18
5.2.80.0070.0329.18
5.2.70.0060.0329.18
5.2.60.0040.0339.14
5.2.50.0060.0319.11
5.2.40.0050.0299.08
5.2.30.0060.0309.05
5.2.20.0040.0299.04
5.2.10.0050.0288.94
5.2.00.0020.0318.82
5.1.60.0040.0258.10
5.1.50.0050.0268.09
5.1.40.0040.0268.07
5.1.30.0060.0258.42
5.1.20.0060.0318.45
5.1.10.0070.0248.18
5.1.00.0030.0298.18
5.0.50.0050.0236.64
5.0.40.0030.0226.50
5.0.30.0060.0316.31
5.0.20.0020.0206.28
5.0.10.0010.0246.26
5.0.00.0050.0356.25
4.4.90.0010.0234.78
4.4.80.0050.0194.75
4.4.70.0050.0194.75
4.4.60.0050.0194.76
4.4.50.0070.0174.77
4.4.40.0050.0314.71
4.4.30.0010.0234.76
4.4.20.0030.0224.84
4.4.10.0030.0224.85
4.4.00.0030.0324.76
4.3.110.0040.0214.67
4.3.100.0070.0184.66
4.3.90.0050.0184.63
4.3.80.0020.0284.59
4.3.70.0030.0144.63
4.3.60.0060.0124.63
4.3.50.0000.0184.63
4.3.40.0040.0284.54
4.3.30.0030.0213.28
4.3.20.0030.0203.26
4.3.10.0010.0223.22
4.3.00.0130.0337.20

preferences:
50.66 ms | 401 KiB | 5 Q