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; 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($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.0140.00718.18
8.3.50.0130.00821.20
8.3.40.0040.01118.76
8.3.30.0150.00618.97
8.3.20.0070.00020.16
8.3.10.0040.00421.85
8.3.00.0040.00419.26
8.2.180.0070.00718.03
8.2.170.0040.01122.96
8.2.160.0000.01420.38
8.2.150.0070.00724.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00322.26
8.2.110.0060.00320.51
8.2.100.0040.00817.79
8.2.90.0050.00818.22
8.2.80.0040.00417.97
8.2.70.0080.00317.63
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0070.00318.22
8.2.30.0040.00417.96
8.2.20.0040.00417.77
8.2.10.0040.00418.14
8.2.00.0040.00417.61
8.1.280.0090.01225.92
8.1.270.0040.00422.01
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0100.00022.09
8.1.230.0070.00420.85
8.1.220.0040.00417.74
8.1.210.0040.00418.93
8.1.200.0060.00317.36
8.1.190.0060.00317.22
8.1.180.0080.00018.10
8.1.170.0110.00018.74
8.1.160.0070.00022.05
8.1.150.0040.00418.91
8.1.140.0020.00517.52
8.1.130.0070.00017.85
8.1.120.0020.00517.52
8.1.110.0040.00417.43
8.1.100.0000.00717.37
8.1.90.0040.00417.50
8.1.80.0040.00317.36
8.1.70.0070.00017.42
8.1.60.0040.00817.49
8.1.50.0040.00417.44
8.1.40.0050.00317.58
8.1.30.0060.00317.60
8.1.20.0050.00317.57
8.1.10.0000.00817.48
8.1.00.0040.00417.50
8.0.300.0040.00420.15
8.0.290.0050.00216.75
8.0.280.0030.00318.44
8.0.270.0070.00017.19
8.0.260.0040.00417.34
8.0.250.0060.00017.01
8.0.240.0080.00016.88
8.0.230.0050.00317.03
8.0.220.0000.00716.83
8.0.210.0040.00216.92
8.0.200.0040.00417.02
8.0.190.0030.00616.98
8.0.180.0040.00416.94
8.0.170.0030.00616.84
8.0.160.0000.00716.84
8.0.150.0070.00016.94
8.0.140.0030.00516.78
8.0.130.0000.00513.34
8.0.120.0040.00416.90
8.0.110.0000.00716.97
8.0.100.0020.00516.80
8.0.90.0050.00316.79
8.0.80.0100.01016.90
8.0.70.0030.00516.96
8.0.60.0080.00017.03
8.0.50.0030.00516.95
8.0.30.0160.00317.14
8.0.20.0100.01017.40
8.0.10.0040.00417.10
8.0.00.0080.01016.98
7.4.330.0050.00015.00
7.4.320.0060.00016.52
7.4.300.0030.00316.63
7.4.290.0000.00716.42
7.4.280.0090.00516.52
7.4.270.0030.00316.61
7.4.260.0040.00416.62
7.4.250.0070.00316.54
7.4.240.0030.00516.59
7.4.230.0030.00316.65
7.4.220.0160.00316.73
7.4.210.0180.00016.43
7.4.200.0030.00316.70
7.4.160.0060.01016.61
7.4.150.0100.00817.40
7.4.140.0100.01017.86
7.4.130.0070.01316.59
7.4.120.0110.00616.53
7.4.110.0080.00816.61
7.4.100.0140.00616.64
7.4.90.0140.00316.46
7.4.80.0100.01019.39
7.4.70.0070.01016.54
7.4.60.0090.00616.65
7.4.50.0000.00716.59
7.4.40.0090.01216.45
7.4.30.0080.01616.71
7.4.10.0130.00614.74
7.4.00.0120.00514.85
7.3.330.0000.00513.32
7.3.320.0000.00513.27
7.3.310.0000.01016.33
7.3.300.0000.00716.35
7.3.290.0110.00416.41
7.3.280.0110.00516.34
7.3.270.0060.01217.40
7.3.260.0000.01716.38
7.3.250.0100.00616.37
7.3.240.0120.00616.68
7.3.230.0130.00516.47
7.3.210.0030.02016.61
7.3.200.0090.00919.39
7.3.190.0120.00616.65
7.3.180.0030.01216.17
7.3.170.0000.01716.52
7.3.160.0120.00316.49
7.3.130.0070.01314.85
7.3.120.0070.01115.04
7.3.110.0100.00614.56
7.3.100.0030.01014.60
7.3.90.0070.01015.16
7.3.80.0070.00314.62
7.3.70.0060.00914.93
7.3.60.0030.01314.59
7.3.50.0060.01314.44
7.3.40.0070.01014.97
7.3.30.0030.01014.83
7.3.20.0030.01016.66
7.3.10.0080.00616.49
7.3.00.0070.00616.56
7.2.330.0110.00616.80
7.2.320.0040.01216.74
7.2.310.0120.00616.70
7.2.300.0030.01316.78
7.2.290.0130.01016.68
7.2.260.0040.01615.14
7.2.250.0090.00915.01
7.2.240.0000.01015.19
7.2.230.0030.01415.21
7.2.220.0110.00015.29
7.2.210.0120.00415.31
7.2.200.0050.00515.14
7.2.190.0060.01015.07
7.2.180.0070.01315.05
7.2.170.0090.00615.18
7.2.160.0090.00614.96
7.2.150.0110.01116.56
7.2.140.0000.01316.60
7.2.130.0070.00816.98
7.2.120.0040.00816.94
7.2.110.0110.00516.91
7.2.100.0070.00816.79
7.2.90.0070.00916.96
7.2.80.0050.00916.94
7.2.70.0060.01016.83
7.2.60.0100.00516.80
7.2.50.0080.00516.87
7.2.40.0050.00916.82
7.2.30.0080.00616.88
7.2.20.0090.00716.85
7.2.10.0060.00716.90
7.2.00.0060.00817.47
7.1.330.0080.00315.71
7.1.320.0070.00715.51
7.1.310.0060.00915.88
7.1.300.0140.00015.71
7.1.290.0070.00315.68
7.1.280.0110.00415.65
7.1.270.0070.00715.70
7.1.260.0030.00715.77
7.1.250.0040.01015.69
7.1.240.0070.00715.82
7.1.230.0040.01115.54
7.1.220.0000.00915.64
7.1.210.0000.01515.82
7.1.200.0050.00615.73
7.1.190.0040.00815.91
7.1.180.0000.01215.78
7.1.170.0030.01015.77
7.1.160.0070.01115.87
7.1.150.0100.00315.80
7.1.140.0040.01215.83
7.1.130.0000.01415.70
7.1.120.0040.00715.70
7.1.110.0030.01215.96
7.1.100.0060.00516.80
7.1.90.0070.00715.50
7.1.80.0030.01015.66
7.1.70.0020.01116.34
7.1.60.0030.01317.59
7.1.50.0100.00816.29
7.1.40.0030.01315.50
7.1.30.0090.00015.75
7.1.20.0030.00815.60
7.1.10.0060.00915.88
7.1.00.0000.04819.03
7.0.330.0060.00615.04
7.0.320.0060.00615.47
7.0.310.0060.00615.29
7.0.300.0100.00715.06
7.0.290.0110.00315.20
7.0.280.0080.00415.58
7.0.270.0070.00715.34
7.0.260.0070.00715.43
7.0.250.0080.00415.04
7.0.240.0090.00615.62
7.0.230.0040.00415.19
7.0.220.0030.01015.54
7.0.210.0110.00015.42
7.0.200.0020.00715.82
7.0.190.0090.00315.43
7.0.180.0000.01715.23
7.0.170.0070.00715.29
7.0.160.0040.00815.42
7.0.150.0080.00815.11
7.0.140.0050.03718.82
7.0.130.0000.00915.42
7.0.120.0070.00315.44
7.0.110.0080.00315.59
7.0.100.0000.01215.47
7.0.90.0030.01015.60
7.0.80.0030.01015.30
7.0.70.0080.00415.01
7.0.60.0100.03817.48
7.0.50.0080.04316.68
7.0.40.0050.02816.81
7.0.30.0120.03116.93
7.0.20.0190.02516.96
7.0.10.0130.04816.80
7.0.00.0070.04916.80
5.6.400.0070.00314.56
5.6.390.0030.00914.58
5.6.380.0090.00414.63
5.6.370.0060.01014.25
5.6.360.0000.01414.44
5.6.350.0090.00614.36
5.6.340.0030.00714.46
5.6.330.0000.01414.59
5.6.320.0080.00614.30
5.6.310.0040.00714.57
5.6.300.0110.00314.75
5.6.290.0030.01214.44
5.6.280.0080.04017.81
5.6.270.0000.01114.35
5.6.260.0100.00714.46
5.6.250.0100.00314.05
5.6.240.0000.00914.25
5.6.230.0040.01414.35
5.6.220.0100.00314.17
5.6.210.0040.02617.47
5.6.200.0080.04216.23
5.6.190.0050.02317.33
5.6.180.1900.03217.50
5.6.170.0210.03317.54
5.6.160.0030.02717.26
5.6.150.0050.02416.24
5.6.140.0110.01716.42
5.6.130.0050.03016.31
5.6.120.0100.04317.61
5.6.110.0270.03017.64
5.6.100.0120.03517.59
5.6.90.0080.04517.65
5.6.80.0070.02317.43
5.6.70.2220.02417.39
5.6.60.0080.00414.36
5.6.50.0130.00314.21
5.6.40.0060.00314.62
5.6.30.0090.00314.43
5.6.20.0060.00614.38
5.6.10.0060.00614.40
5.6.00.0070.00314.39
5.5.380.0030.00914.39
5.5.370.0100.00314.16
5.5.360.0070.00714.49
5.5.350.0050.03517.44
5.5.340.0090.04216.20
5.5.330.0140.03717.21
5.5.320.0170.04317.10
5.5.310.0150.04317.32
5.5.300.0120.03016.23
5.5.290.0020.04916.10
5.5.280.0090.03717.50
5.5.270.0070.02517.51
5.5.260.0140.03717.60
5.5.250.0070.04217.61
5.5.240.0070.03317.16
5.5.230.0000.00814.36
5.5.220.0030.00814.41
5.5.210.0100.00714.49
5.5.200.0070.00314.41
5.5.190.0060.00614.29
5.5.180.0070.00714.49
5.5.170.0060.00914.11
5.5.160.0030.00614.35
5.5.150.0060.00614.06
5.5.140.0040.01114.17
5.5.130.0080.00014.27
5.5.120.0030.01514.45
5.5.110.0100.00714.21
5.5.100.0060.00614.35
5.5.90.0030.01314.30
5.5.80.0000.00914.30
5.5.70.0040.01114.18
5.5.60.0080.00414.30
5.5.50.0000.00914.48
5.5.40.0140.00014.61
5.5.30.0060.00614.07
5.5.20.0070.00714.28
5.5.10.0060.00914.23
5.5.00.0060.00614.05
5.4.450.0080.04015.39
5.4.440.0300.03515.36
5.4.430.0300.03715.31
5.4.420.0350.00315.25
5.4.410.0380.00015.08
5.4.400.0320.00415.18
5.4.390.0350.00015.17
5.4.380.0400.00615.13
5.4.370.0330.00215.23
5.4.360.0330.00215.20
5.4.350.0330.00615.14
5.4.340.0090.01811.61
5.4.330.0100.00210.83
5.4.320.0030.02411.68
5.4.310.0070.02111.68
5.4.300.0050.02011.82
5.4.290.0030.02211.76
5.4.280.0070.02011.88
5.4.270.0070.02011.71
5.4.260.0050.02411.68
5.4.250.0060.02311.68
5.4.240.0070.02111.79
5.4.230.0050.02111.62
5.4.220.0060.01911.74
5.4.210.0060.02111.64
5.4.200.0040.02111.72
5.4.190.0050.02211.80
5.4.180.0040.02211.66
5.4.170.0080.01811.84
5.4.160.0060.02111.80
5.4.150.0030.02411.62
5.4.140.0020.02511.63
5.4.130.0040.02311.56
5.4.120.0070.01911.55
5.4.110.0040.02111.57
5.4.100.0060.02011.56
5.4.90.0050.02111.53
5.4.80.0040.02411.54
5.4.70.0040.02311.45
5.4.60.0040.02211.57
5.4.50.0050.02011.57
5.4.40.0040.02211.59
5.4.30.0030.02411.49
5.4.20.0080.01911.63
5.4.10.0020.02311.51
5.4.00.0040.02311.37
5.3.290.0080.04212.80
5.3.280.0060.04312.71
5.3.270.0110.05112.73
5.3.260.0080.04312.72
5.3.250.0070.04212.72
5.3.240.0060.05112.72
5.3.230.0090.04112.71
5.3.220.0030.04312.68
5.3.210.0040.04312.68
5.3.200.0070.03612.68
5.3.190.0070.03712.68
5.3.180.0080.03512.68
5.3.170.0070.03612.67
5.3.160.0010.04212.68
5.3.150.0120.04012.67
5.3.140.0060.04812.66
5.3.130.0060.03812.66
5.3.120.0080.03612.66
5.3.110.0020.04312.66
5.3.100.0110.04312.13
5.3.90.0070.03512.11
5.3.80.0100.03412.10
5.3.70.0130.04212.09
5.3.60.0050.03712.09
5.3.50.0060.04012.03
5.3.40.0040.04012.03
5.3.30.0060.03511.98
5.3.20.0070.03611.78
5.3.10.0040.03711.73
5.3.00.0070.03511.72
5.2.170.0050.0339.22
5.2.160.0070.0339.23
5.2.150.0090.0299.23
5.2.140.0060.0309.22
5.2.130.0030.0309.18
5.2.120.0090.0249.18
5.2.110.0060.0279.19
5.2.100.0060.0279.18
5.2.90.0080.0269.18
5.2.80.0030.0319.18
5.2.70.0010.0339.18
5.2.60.0010.0339.14
5.2.50.0060.0289.11
5.2.40.0030.0309.09
5.2.30.0040.0329.05
5.2.20.0070.0279.04
5.2.10.0040.0288.95
5.2.00.0020.0318.81
5.1.60.0040.0248.09
5.1.50.0050.0268.09
5.1.40.0010.0298.08
5.1.30.0030.0278.42
5.1.20.0050.0278.45
5.1.10.0050.0258.17
5.1.00.0040.0318.18
5.0.50.0010.0236.64
5.0.40.0050.0186.50
5.0.30.0040.0306.31
5.0.20.0040.0196.28
5.0.10.0030.0206.26
5.0.00.0030.0326.25
4.4.90.0000.0184.78
4.4.80.0030.0154.75
4.4.70.0030.0154.75
4.4.60.0020.0174.76
4.4.50.0040.0164.77
4.4.40.0030.0254.71
4.4.30.0050.0144.75
4.4.20.0030.0164.84
4.4.10.0040.0144.85
4.4.00.0010.0274.76
4.3.110.0040.0144.67
4.3.100.0020.0164.67
4.3.90.0080.0104.64
4.3.80.0040.0244.58
4.3.70.0030.0154.63
4.3.60.0020.0164.63
4.3.50.0040.0144.63
4.3.40.0030.0244.54
4.3.30.0040.0143.28
4.3.20.0020.0163.26
4.3.10.0010.0173.22
4.3.00.0170.03712.14

preferences:
48.86 ms | 401 KiB | 5 Q