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($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 { } 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.0110.00418.30
8.3.50.0000.01517.98
8.3.40.0040.01219.02
8.3.30.0100.01018.92
8.3.20.0070.00020.34
8.3.10.0080.00023.39
8.3.00.0080.00019.26
8.2.180.0000.01416.49
8.2.170.0110.00322.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0000.00719.83
8.2.110.0060.00321.96
8.2.100.0060.00617.50
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0040.00717.50
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0080.00418.16
8.2.30.0060.00318.14
8.2.20.0080.00017.61
8.2.10.0040.00417.95
8.2.00.0050.00317.70
8.1.280.0170.00025.92
8.1.270.0090.00022.01
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0000.00923.92
8.1.230.0060.00619.13
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00717.25
8.1.190.0000.00817.35
8.1.180.0060.00318.10
8.1.170.0000.01018.57
8.1.160.0040.00422.03
8.1.150.0040.00418.82
8.1.140.0040.00417.41
8.1.130.0030.00317.75
8.1.120.0020.00517.36
8.1.110.0040.00417.53
8.1.100.0050.00217.48
8.1.90.0040.00417.40
8.1.80.0000.00717.38
8.1.70.0030.00317.44
8.1.60.0100.00317.63
8.1.50.0030.00517.51
8.1.40.0000.00817.51
8.1.30.0040.00417.68
8.1.20.0060.00317.62
8.1.10.0080.00017.62
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0000.00818.49
8.0.270.0030.00317.21
8.0.260.0060.00017.17
8.0.250.0030.00316.95
8.0.240.0030.00516.97
8.0.230.0030.00316.93
8.0.220.0030.00316.80
8.0.210.0030.00316.78
8.0.200.0000.00716.96
8.0.190.0000.00716.85
8.0.180.0000.00716.90
8.0.170.0000.00816.84
8.0.160.0000.00716.93
8.0.150.0040.00416.91
8.0.140.0040.00416.78
8.0.130.0060.00013.38
8.0.120.0050.00216.86
8.0.110.0040.00416.87
8.0.100.0000.00816.75
8.0.90.0080.00016.93
8.0.80.0090.01316.96
8.0.70.0050.00316.98
8.0.60.0000.00716.85
8.0.50.0000.00816.89
8.0.30.0130.00717.07
8.0.20.0110.00917.40
8.0.10.0070.00017.06
8.0.00.0130.00416.73
7.4.330.0000.00515.00
7.4.320.0070.00016.63
7.4.300.0060.00016.57
7.4.290.0060.00016.45
7.4.280.0060.00616.65
7.4.270.0000.00716.53
7.4.260.0000.00716.50
7.4.250.0000.00716.48
7.4.240.0070.00016.54
7.4.230.0040.00416.37
7.4.220.0100.00716.61
7.4.210.0060.00916.72
7.4.200.0040.00516.64
7.4.160.0100.00616.35
7.4.150.0070.01117.40
7.4.140.0060.01517.86
7.4.130.0140.00416.44
7.4.120.0110.00616.58
7.4.110.0070.01016.50
7.4.100.0170.00416.65
7.4.90.0160.00016.43
7.4.80.0100.00819.39
7.4.70.0120.00616.39
7.4.60.0090.00616.46
7.4.50.0030.00516.40
7.4.40.0060.01616.27
7.4.30.0130.00416.60
7.4.10.0110.00714.79
7.4.00.0100.00814.97
7.3.330.0000.00513.20
7.3.320.0000.00513.29
7.3.310.0030.00316.37
7.3.300.0000.00716.25
7.3.290.0160.00316.27
7.3.280.0090.00816.30
7.3.270.0140.01017.40
7.3.260.0150.00616.66
7.3.250.0140.00316.51
7.3.240.0130.01016.47
7.3.230.0040.01216.44
7.3.210.0100.00716.46
7.3.200.0060.01219.39
7.3.190.0120.01216.54
7.3.180.0100.01016.58
7.3.170.0100.00716.40
7.3.160.0100.00716.36
7.3.130.0060.00914.83
7.3.120.0100.00814.89
7.3.110.0100.00814.83
7.3.100.0030.01114.72
7.3.90.0080.00714.62
7.3.80.0080.00514.89
7.3.70.0050.01214.72
7.3.60.0050.01014.84
7.3.50.0090.00614.67
7.3.40.0020.01314.70
7.3.30.0100.00614.95
7.3.20.0050.00916.56
7.3.10.0070.00616.59
7.3.00.0060.01216.70
7.2.330.0030.01316.70
7.2.320.0070.01016.82
7.2.310.0090.00916.84
7.2.300.0100.00716.68
7.2.290.0130.00316.53
7.2.260.0090.01114.88
7.2.250.0100.00915.04
7.2.240.0080.01014.95
7.2.230.0060.00815.16
7.2.220.0080.00814.94
7.2.210.0100.00515.08
7.2.200.0070.01015.02
7.2.190.0040.01214.98
7.2.180.0060.00814.79
7.2.170.0090.00615.01
7.2.160.0060.00915.13
7.2.150.0090.00616.88
7.2.140.0040.01116.77
7.2.130.0060.00916.73
7.2.120.0000.00916.75
7.2.110.0030.00916.79
7.2.100.0030.00916.53
7.2.90.0110.00416.71
7.2.80.0030.01317.03
7.2.70.0100.00316.63
7.2.60.0020.01216.93
7.2.50.0090.00616.77
7.2.40.0030.00716.87
7.2.30.0040.00716.71
7.2.20.0060.00616.81
7.2.10.0000.01516.82
7.2.00.0050.01118.10
7.1.330.0030.01215.81
7.1.320.0030.00915.71
7.1.310.0070.00715.83
7.1.300.0090.00515.71
7.1.290.0040.00715.64
7.1.280.0060.00615.46
7.1.270.0070.00815.51
7.1.260.0040.00615.91
7.1.250.0040.01615.46
7.1.240.0070.00715.67
7.1.230.0100.00315.51
7.1.220.0040.00715.63
7.1.210.0060.00915.52
7.1.200.0030.01115.73
7.1.190.0060.00615.52
7.1.180.0060.00915.25
7.1.170.0030.00915.53
7.1.160.0040.00715.64
7.1.150.0000.01315.32
7.1.140.0070.00715.57
7.1.130.0110.00415.66
7.1.120.0090.00315.48
7.1.110.0060.00615.79
7.1.100.0070.00916.91
7.1.90.0060.00915.41
7.1.80.0040.00815.58
7.1.70.0030.00816.55
7.1.60.0110.00717.45
7.1.50.0070.01216.28
7.1.40.0030.00615.80
7.1.30.0070.00715.65
7.1.20.0060.00615.39
7.1.10.0040.00815.47
7.1.00.0080.03619.03
7.0.330.0090.00615.43
7.0.320.0100.00315.55
7.0.310.0030.01015.50
7.0.300.0030.00615.27
7.0.290.0060.00615.29
7.0.280.0040.00815.53
7.0.270.0060.00915.49
7.0.260.0030.00715.34
7.0.250.0040.00815.26
7.0.240.0030.01015.18
7.0.230.0030.01015.35
7.0.220.0030.00915.20
7.0.210.0030.00915.36
7.0.200.0070.00116.07
7.0.190.0060.00915.49
7.0.180.0060.00615.49
7.0.170.0090.00015.37
7.0.160.0060.00315.53
7.0.150.0000.01415.47
7.0.140.0080.03618.69
7.0.130.0060.00615.13
7.0.120.0100.00715.43
7.0.110.0030.00615.49
7.0.100.0030.01015.32
7.0.90.0040.00815.36
7.0.80.0070.00715.03
7.0.70.0040.01115.28
7.0.60.0030.02417.65
7.0.50.0070.03216.71
7.0.40.0060.04016.83
7.0.30.0270.04416.82
7.0.20.0170.03016.64
7.0.10.0100.04416.68
7.0.00.0030.02716.81
5.6.400.0090.00614.61
5.6.390.0000.01314.41
5.6.380.0040.01114.58
5.6.370.0040.01114.59
5.6.360.0060.00614.31
5.6.350.0130.00014.58
5.6.340.0040.00414.40
5.6.330.0040.01414.38
5.6.320.0060.00314.34
5.6.310.0000.01614.30
5.6.300.0030.01214.50
5.6.290.0100.00314.36
5.6.280.0030.04317.58
5.6.270.0060.00914.30
5.6.260.0060.00914.44
5.6.250.0090.00614.29
5.6.240.0030.01214.48
5.6.230.0120.00314.23
5.6.220.0030.00914.42
5.6.210.0100.02017.64
5.6.200.0090.02016.37
5.6.190.0080.02517.54
5.6.180.0160.03017.35
5.6.170.0130.02817.40
5.6.160.0080.03817.43
5.6.150.0050.03116.06
5.6.140.0110.02316.42
5.6.130.0130.01816.17
5.6.120.0060.04217.66
5.6.110.0040.03417.62
5.6.100.0090.02317.65
5.6.90.0030.04417.66
5.6.80.0100.02817.33
5.6.70.0030.00914.00
5.6.60.0000.00814.18
5.6.50.0110.00314.15
5.6.40.0040.01114.16
5.6.30.0000.01514.29
5.6.20.0050.00513.88
5.6.10.0060.01214.25
5.6.00.0000.00814.60
5.5.380.0000.01714.14
5.5.370.0080.00414.16
5.5.360.0060.00614.69
5.5.350.0120.04517.40
5.5.340.0070.04516.28
5.5.330.0050.03017.45
5.5.320.0280.03817.50
5.5.310.0140.03017.46
5.5.300.0120.03816.23
5.5.290.0060.03116.21
5.5.280.0080.04817.52
5.5.270.0070.02917.53
5.5.260.0050.02217.63
5.5.250.0040.02717.37
5.5.240.0130.03817.30
5.5.230.0140.00014.45
5.5.220.0060.00914.36
5.5.210.0030.00614.32
5.5.200.0110.00414.36
5.5.190.0030.01014.13
5.5.180.0030.01014.19
5.5.170.0060.01214.04
5.5.160.0100.00314.28
5.5.150.0060.00614.16
5.5.140.0060.00614.52
5.5.130.0030.00614.66
5.5.120.0040.01114.26
5.5.110.0060.00613.87
5.5.100.0000.01814.27
5.5.90.0130.00314.09
5.5.80.0000.01114.39
5.5.70.0060.00314.20
5.5.60.0000.01214.18
5.5.50.0100.00314.31
5.5.40.0060.00614.36
5.5.30.0080.00614.35
5.5.20.0000.01414.39
5.5.10.0040.00814.28
5.5.00.0090.00614.09
5.4.450.0460.02815.33
5.4.440.0400.04015.27
5.4.430.0380.02715.42
5.4.420.0350.00215.21
5.4.410.0360.00115.23
5.4.400.0400.00315.15
5.4.390.0330.00315.08
5.4.380.0350.00415.05
5.4.370.0320.00415.16
5.4.360.0330.00315.07
5.4.350.0330.00315.16
5.4.340.0090.02311.54
5.4.330.0090.00311.05
5.4.320.0060.02011.90
5.4.310.0050.02111.84
5.4.300.0050.02211.79
5.4.290.0040.02511.78
5.4.280.0050.01811.76
5.4.270.0050.02111.76
5.4.260.0020.02511.78
5.4.250.0040.02311.73
5.4.240.0020.02411.73
5.4.230.0050.02311.73
5.4.220.0060.02111.86
5.4.210.0030.02111.73
5.4.200.0070.02411.74
5.4.190.0060.02311.75
5.4.180.0030.02311.78
5.4.170.0070.01911.81
5.4.160.0050.01911.73
5.4.150.0040.02111.73
5.4.140.0020.02611.59
5.4.130.0030.02311.74
5.4.120.0050.02211.54
5.4.110.0040.02211.59
5.4.100.0050.02111.54
5.4.90.0050.02311.61
5.4.80.0040.02011.63
5.4.70.0030.02211.54
5.4.60.0050.02411.60
5.4.50.0030.02211.54
5.4.40.0020.02211.54
5.4.30.0020.02511.53
5.4.20.0070.01711.63
5.4.10.0070.01911.53
5.4.00.0060.02211.36
5.3.290.0080.03612.80
5.3.280.0050.03812.71
5.3.270.0080.03512.73
5.3.260.0070.04212.72
5.3.250.0100.04212.71
5.3.240.0070.03812.72
5.3.230.0050.04212.71
5.3.220.0070.03512.68
5.3.210.0050.03912.68
5.3.200.0030.03912.68
5.3.190.0070.03612.68
5.3.180.0060.03612.68
5.3.170.0060.03512.67
5.3.160.0090.03712.67
5.3.150.0040.04012.67
5.3.140.0030.03912.66
5.3.130.0080.03612.66
5.3.120.0040.04112.65
5.3.110.0090.03512.65
5.3.100.0070.03612.13
5.3.90.0070.03412.11
5.3.80.0040.04212.10
5.3.70.0070.03412.09
5.3.60.0090.03312.08
5.3.50.0050.03712.03
5.3.40.0060.03612.03
5.3.30.0050.03511.98
5.3.20.0070.03311.77
5.3.10.0040.03611.73
5.3.00.0050.03711.72
5.2.170.0050.0309.22
5.2.160.0050.0299.23
5.2.150.0050.0309.23
5.2.140.0040.0319.22
5.2.130.0070.0339.18
5.2.120.0040.0289.18
5.2.110.0060.0289.19
5.2.100.0070.0289.18
5.2.90.0040.0299.18
5.2.80.0060.0289.18
5.2.70.0040.0309.18
5.2.60.0040.0309.14
5.2.50.0080.0279.11
5.2.40.0070.0279.08
5.2.30.0080.0269.05
5.2.20.0050.0289.04
5.2.10.0040.0288.95
5.2.00.0050.0288.81
5.1.60.0040.0268.10
5.1.50.0040.0258.10
5.1.40.0040.0258.07
5.1.30.0070.0238.42
5.1.20.0050.0258.45
5.1.10.0050.0248.18
5.1.00.0040.0278.17
5.0.50.0060.0336.64
5.0.40.0050.0236.51
5.0.30.0060.0286.31
5.0.20.0020.0206.28
5.0.10.0030.0206.26
5.0.00.0040.0296.25
4.4.90.0020.0164.78
4.4.80.0020.0154.75
4.4.70.0020.0164.76
4.4.60.0040.0154.76
4.4.50.0040.0134.77
4.4.40.0050.0224.71
4.4.30.0030.0154.75
4.4.20.0010.0174.84
4.4.10.0030.0164.85
4.4.00.0050.0244.76
4.3.110.0050.0134.67
4.3.100.0030.0144.66
4.3.90.0040.0144.64
4.3.80.0040.0234.58
4.3.70.0040.0134.63
4.3.60.0020.0154.63
4.3.50.0050.0134.63
4.3.40.0030.0234.54
4.3.30.0010.0173.29
4.3.20.0010.0163.26
4.3.10.0030.0143.22
4.3.00.0100.0237.21

preferences:
58.31 ms | 400 KiB | 5 Q