3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Command { public static function fromParams(array $params); public function asArray(); } trait DataTransferObject { 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); } } } class MyCommand implements Command { use DataTransferObject; private $foo; } $foo = MyCommand::fromParams(array('foo' => 'foo')); 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.00418.33
8.3.50.0300.01321.20
8.3.40.0150.00018.70
8.3.30.0060.00919.14
8.3.20.0030.00520.22
8.3.10.0040.00421.73
8.3.00.0040.00419.13
8.2.180.0150.00318.27
8.2.170.0090.00622.96
8.2.160.0070.00720.53
8.2.150.0110.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00422.29
8.2.110.0060.00320.15
8.2.100.0120.00018.16
8.2.90.0030.00519.09
8.2.80.0000.00817.97
8.2.70.0050.00517.21
8.2.60.0000.00817.93
8.2.50.0000.00918.07
8.2.40.0060.00319.95
8.2.30.0000.00718.07
8.2.20.0040.00417.70
8.2.10.0040.00418.16
8.2.00.0000.00817.66
8.1.280.0110.00825.92
8.1.270.0000.00822.08
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00622.05
8.1.230.0000.01117.82
8.1.220.0040.00417.74
8.1.210.0090.00018.77
8.1.200.0060.00317.23
8.1.190.0040.00417.00
8.1.180.0030.00518.10
8.1.170.0040.00418.67
8.1.160.0040.00422.02
8.1.150.0000.00718.89
8.1.140.0000.00717.52
8.1.130.0040.00417.81
8.1.120.0020.00517.39
8.1.110.0040.00417.38
8.1.100.0040.00417.38
8.1.90.0000.00717.44
8.1.80.0040.00417.55
8.1.70.0070.00017.46
8.1.60.0070.00717.61
8.1.50.0080.00017.50
8.1.40.0000.00817.46
8.1.30.0050.00317.66
8.1.20.0030.00617.57
8.1.10.0060.00317.66
8.1.00.0030.00617.47
8.0.300.0090.00018.77
8.0.290.0030.00516.75
8.0.280.0040.00418.51
8.0.270.0030.00517.39
8.0.260.0040.00417.15
8.0.250.0080.00017.02
8.0.240.0040.00416.98
8.0.230.0040.00417.00
8.0.220.0070.00016.90
8.0.210.0000.00716.93
8.0.200.0000.00716.94
8.0.190.0000.00816.91
8.0.180.0000.00716.82
8.0.170.0000.00816.93
8.0.160.0040.00416.85
8.0.150.0000.00716.91
8.0.140.0070.00016.87
8.0.130.0000.00513.43
8.0.120.0030.00516.75
8.0.110.0050.00316.89
8.0.100.0040.00416.75
8.0.90.0020.00516.86
8.0.80.0030.01416.90
8.0.70.0030.00516.73
8.0.60.0040.00416.91
8.0.50.0020.00516.81
8.0.30.0140.00817.01
8.0.20.0100.01617.40
8.0.10.0000.00716.95
8.0.00.0070.01016.72
7.4.330.0050.00015.00
7.4.320.0030.00316.52
7.4.300.0000.00616.47
7.4.290.0040.00416.61
7.4.280.0090.00316.48
7.4.270.0030.00316.60
7.4.260.0070.00016.55
7.4.250.0070.00016.56
7.4.240.0040.00416.59
7.4.230.0030.00316.43
7.4.220.0090.00916.54
7.4.210.0110.00316.71
7.4.200.0000.00716.50
7.4.160.0090.00616.53
7.4.150.0090.00917.40
7.4.140.0080.01017.86
7.4.130.0120.00516.48
7.4.120.0060.01216.54
7.4.110.0130.00716.50
7.4.100.0080.01216.64
7.4.90.0310.02116.43
7.4.80.0110.01419.39
7.4.70.0130.00616.49
7.4.60.0130.00316.54
7.4.50.0080.00016.65
7.4.40.0100.00716.59
7.4.30.0100.01016.46
7.4.00.0110.00614.87
7.3.330.0050.00013.20
7.3.320.0000.00513.34
7.3.310.0040.00416.14
7.3.300.0030.00316.34
7.3.290.0000.01416.32
7.3.280.0070.00816.33
7.3.270.0090.00917.40
7.3.260.0110.00716.39
7.3.250.0080.01116.45
7.3.240.0170.00816.52
7.3.230.0070.01016.58
7.3.210.0100.00716.37
7.3.200.0120.00619.39
7.3.190.0090.00916.51
7.3.180.0070.01116.25
7.3.170.0160.00716.38
7.3.160.0050.01116.36
7.3.120.0070.01114.54
7.3.110.0000.01614.56
7.3.100.0100.00715.04
7.3.90.0040.00814.82
7.3.80.0070.00714.90
7.3.70.0060.00614.82
7.3.60.0070.01014.49
7.3.50.0030.01314.90
7.3.40.0060.00314.87
7.3.30.0070.00714.59
7.3.20.0000.01316.87
7.3.10.0080.00516.59
7.3.00.0020.01016.67
7.2.330.0130.00416.73
7.2.320.0140.00516.64
7.2.310.0030.01316.78
7.2.300.0090.00616.82
7.2.290.0060.01616.61
7.2.250.0030.01415.00
7.2.240.0100.01015.20
7.2.230.0080.00415.21
7.2.220.0060.00314.74
7.2.210.0070.00715.16
7.2.200.0080.00415.01
7.2.190.0080.00814.87
7.2.180.0100.00314.79
7.2.170.0070.00714.96
7.2.130.0030.00916.85
7.2.120.0080.00516.93
7.2.110.0100.00916.98
7.2.100.0090.01016.61
7.2.90.0110.00816.94
7.2.80.0050.00816.79
7.2.70.0080.00916.80
7.2.60.0080.00616.90
7.2.50.0090.00516.67
7.2.40.0080.00816.82
7.2.30.0070.00716.93
7.2.20.0030.01016.62
7.2.10.0020.01216.98
7.2.00.0050.00616.76
7.1.330.0070.00715.81
7.1.320.0040.00815.82
7.1.310.0040.01115.64
7.1.300.0030.01015.66
7.1.290.0070.00715.58
7.1.280.0040.00715.99
7.1.270.0040.01215.82
7.1.260.0040.00815.99
7.1.250.0090.00515.42
7.1.70.0000.00717.09
7.1.60.0100.01319.32
7.1.50.0150.00616.50
7.1.00.0030.07722.52
7.0.200.0000.01016.97
7.0.140.0030.07322.09
7.0.60.0130.08020.05
7.0.50.0030.04017.99
7.0.40.0070.09020.23
7.0.30.0300.07320.05
7.0.20.0300.06720.26
7.0.10.0070.06720.07
7.0.00.0100.08320.15
5.6.280.0070.07021.00
5.6.210.0070.03720.63
5.6.200.0130.03318.18
5.6.190.0130.05320.55
5.6.180.0300.07020.54
5.6.170.0370.07720.39
5.6.160.0070.07020.57
5.6.150.0000.04718.27
5.6.140.0030.04018.18
5.6.130.0030.04318.21
5.6.120.0100.08020.75
5.6.110.0130.07721.00
5.6.100.0100.04321.03
5.6.90.0100.08321.09
5.6.80.0100.04720.52
5.5.350.0130.03320.31
5.5.340.0030.06317.99
5.5.330.0100.07020.27
5.5.320.0270.04720.32
5.5.310.0400.06720.41
5.5.300.0000.04318.07
5.5.290.0000.07318.03
5.5.280.0030.06720.77
5.5.270.0070.07720.74
5.5.260.0070.08720.88
5.5.250.0170.07320.71
5.5.240.0300.04720.21
5.4.450.0930.05019.41
5.4.440.0730.06319.34
5.4.430.0100.05319.16
5.4.420.0670.00019.32
5.4.410.0800.00019.21
5.4.400.0800.00019.29
5.4.390.0630.00019.06
5.4.380.0630.00019.13
5.4.370.0630.00019.07
5.4.360.0600.00019.13
5.4.350.0630.00019.25
5.4.340.0080.03812.02
5.4.320.0100.04312.51
5.4.310.0050.04012.50
5.4.300.0090.03812.51
5.4.290.0090.04012.51
5.4.280.0090.03312.41
5.4.270.0050.03712.40
5.4.260.0100.03412.40
5.4.250.0070.04312.40
5.4.240.0050.03712.40
5.4.230.0060.03912.39
5.4.220.0040.03812.39
5.4.210.0060.03612.39
5.4.200.0050.03812.39
5.4.190.0050.03712.39
5.4.180.0030.03712.39
5.4.170.0050.03512.40
5.4.160.0050.03512.39
5.4.150.0030.03812.40
5.4.140.0080.03512.08
5.4.130.0050.04212.07
5.4.120.0060.03812.02
5.4.110.0090.03212.02
5.4.100.0100.04812.02
5.4.90.0040.05312.02
5.4.80.0100.04712.02
5.4.70.0080.04312.01
5.4.60.0050.03612.02
5.4.50.0070.03412.02
5.4.40.0050.04012.00
5.4.30.0080.03312.00
5.4.20.0080.03412.00
5.4.10.0080.03512.00
5.4.00.0100.03111.49
5.3.290.0030.04212.80
5.3.280.0090.03412.71
5.3.270.0080.03812.72
5.3.260.0050.04412.72
5.3.250.0070.03512.72
5.3.240.0060.03612.72
5.3.230.0050.03812.71
5.3.220.0060.03612.68
5.3.210.0040.04012.68
5.3.200.0050.03612.68
5.3.190.0060.03712.68
5.3.180.0060.03612.67
5.3.170.0060.03612.66
5.3.160.0050.03712.68
5.3.150.0040.03812.68
5.3.140.0060.03612.66
5.3.130.0050.04012.66
5.3.120.0090.03612.66
5.3.110.0080.04012.66
5.3.100.0040.03912.13
5.3.90.0050.03612.11
5.3.80.0070.04012.10
5.3.70.0100.03312.09
5.3.60.0050.03812.08
5.3.50.0060.04312.03
5.3.40.0030.03912.03
5.3.30.0030.03711.98
5.3.20.0080.03311.77
5.3.10.0060.03511.73
5.3.00.0060.03511.72
5.2.170.0050.0309.22
5.2.160.0050.0359.22
5.2.150.0040.0319.23
5.2.140.0040.0319.22
5.2.130.0060.0279.18
5.2.120.0050.0339.18
5.2.110.0090.0379.19
5.2.100.0050.0369.18
5.2.90.0040.0289.18
5.2.80.0070.0279.18
5.2.70.0030.0319.17
5.2.60.0020.0329.13
5.2.50.0040.0309.11
5.2.40.0060.0279.08
5.2.30.0040.0309.05
5.2.20.0040.0299.04
5.2.10.0020.0308.95
5.2.00.0020.0328.81
5.1.60.0070.0218.09
5.1.50.0040.0248.09
5.1.40.0060.0288.07
5.1.30.0050.0268.42
5.1.20.0030.0288.45
5.1.10.0030.0278.16
5.1.00.0010.0308.16
5.0.50.0080.0216.64
5.0.40.0070.0236.50
5.0.30.0030.0316.31
5.0.20.0050.0236.28
5.0.10.0030.0286.26
5.0.00.0030.0366.25
4.4.90.0030.0154.78
4.4.80.0020.0164.76
4.4.70.0040.0144.75
4.4.60.0040.0144.75
4.4.50.0030.0154.77
4.4.40.0020.0254.70
4.4.30.0040.0144.76
4.4.20.0030.0154.84
4.4.10.0040.0154.85
4.4.00.0060.0304.76
4.3.110.0060.0184.67
4.3.100.0030.0214.66
4.3.90.0040.0144.63
4.3.80.0000.0304.58
4.3.70.0050.0174.63
4.3.60.0020.0164.62
4.3.50.0030.0154.63
4.3.40.0010.0254.54
4.3.30.0020.0153.28
4.3.20.0010.0173.26
4.3.10.0020.0153.22
4.3.00.0200.0137.08

preferences:
38.97 ms | 401 KiB | 5 Q