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 { } class MyCommand extends Command implements DataTransferObject { use DataTransferTrait; 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.70.0130.00616.63
8.3.60.0030.01718.30
8.3.50.0130.00821.09
8.3.40.0070.00718.65
8.3.30.0110.00319.04
8.3.20.0080.00020.25
8.3.10.0080.00021.73
8.3.00.0040.00419.25
8.2.180.0150.00018.29
8.2.170.0070.00722.96
8.2.160.0200.00020.22
8.2.150.0090.00624.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00422.22
8.2.110.0070.00320.35
8.2.100.0120.00017.72
8.2.90.0040.00418.22
8.2.80.0000.00817.97
8.2.70.0030.00517.50
8.2.60.0030.00518.04
8.2.50.0040.00418.07
8.2.40.0040.00420.01
8.2.30.0070.00017.96
8.2.20.0050.00317.73
8.2.10.0040.00418.07
8.2.00.0040.00417.61
8.1.280.0110.00625.92
8.1.270.0000.01122.05
8.1.260.0110.00326.35
8.1.250.0060.00328.09
8.1.240.0040.00422.20
8.1.230.0080.00420.91
8.1.220.0060.00317.74
8.1.210.0000.00818.93
8.1.200.0060.00317.36
8.1.190.0040.00417.11
8.1.180.0040.00418.10
8.1.170.0000.00818.66
8.1.160.0000.00721.95
8.1.150.0000.00718.87
8.1.140.0070.00017.42
8.1.130.0030.00317.76
8.1.120.0080.00017.38
8.1.110.0040.00317.36
8.1.100.0040.00417.52
8.1.90.0050.00317.55
8.1.80.0050.00317.39
8.1.70.0000.00717.41
8.1.60.0070.00317.64
8.1.50.0060.00317.50
8.1.40.0030.00617.58
8.1.30.0000.00917.60
8.1.20.0030.00617.65
8.1.10.0070.00017.63
8.1.00.0000.00817.41
8.0.300.0040.00420.09
8.0.290.0070.00016.88
8.0.280.0000.00818.47
8.0.270.0030.00517.26
8.0.260.0060.00317.32
8.0.250.0070.00017.01
8.0.240.0000.00717.01
8.0.230.0030.00516.87
8.0.220.0030.00316.87
8.0.210.0000.00716.89
8.0.200.0070.00017.00
8.0.190.0080.00016.86
8.0.180.0000.00716.93
8.0.170.0030.00516.85
8.0.160.0000.00716.92
8.0.150.0000.00716.89
8.0.140.0050.00316.88
8.0.130.0050.00013.27
8.0.120.0050.00316.85
8.0.110.0000.00716.80
8.0.100.0050.00316.77
8.0.90.0000.00816.83
8.0.80.0060.01216.83
8.0.70.0050.00316.95
8.0.60.0040.00416.97
8.0.50.0040.00416.91
8.0.30.0100.01016.91
8.0.20.0090.01317.40
8.0.10.0040.00416.90
8.0.00.0120.00616.84
7.4.330.0050.00015.09
7.4.320.0030.00316.60
7.4.300.0000.00616.60
7.4.290.0000.00816.45
7.4.280.0090.00716.57
7.4.270.0000.00616.54
7.4.260.0030.00316.47
7.4.250.0040.00416.61
7.4.240.0040.00316.61
7.4.230.0070.00016.34
7.4.220.0070.01016.62
7.4.210.0070.00716.48
7.4.200.0030.00316.64
7.4.160.0090.00616.29
7.4.150.0120.00617.40
7.4.140.0050.01317.86
7.4.130.0110.00616.54
7.4.120.0100.00716.55
7.4.110.0080.00816.56
7.4.100.0070.01116.40
7.4.90.0120.00616.55
7.4.80.0070.01119.39
7.4.70.0050.01416.72
7.4.60.0000.01516.56
7.4.50.0040.00416.53
7.4.40.0070.01116.67
7.4.30.0160.00316.57
7.4.10.0100.01014.93
7.4.00.0080.00815.15
7.3.330.0050.00013.36
7.3.320.0000.00513.17
7.3.310.0060.00316.15
7.3.300.0030.00316.38
7.3.290.0030.01316.36
7.3.280.0060.00816.37
7.3.270.0060.01217.40
7.3.260.0130.01016.28
7.3.250.0090.00616.39
7.3.240.0100.01116.62
7.3.230.0070.01016.73
7.3.210.0110.00716.56
7.3.200.0070.01019.39
7.3.190.0080.00816.53
7.3.180.0080.00816.73
7.3.170.0110.01116.32
7.3.160.0080.00816.59
7.3.130.0040.01214.56
7.3.120.0070.01014.83
7.3.110.0170.00014.87
7.3.100.0060.00915.18
7.3.90.0030.01014.90
7.3.80.0080.00315.18
7.3.70.0030.00614.56
7.3.60.0060.00614.96
7.3.50.0000.01414.63
7.3.40.0090.00314.89
7.3.30.0030.01014.89
7.3.20.0030.01216.55
7.3.10.0070.00816.70
7.3.00.0060.00916.58
7.2.330.0080.00816.63
7.2.320.0090.00916.71
7.2.310.0070.01016.70
7.2.300.0100.00716.80
7.2.290.0100.01016.54
7.2.260.0120.00415.04
7.2.250.0060.01015.35
7.2.240.0060.00615.03
7.2.230.0030.01215.26
7.2.220.0030.01215.33
7.2.210.0040.01115.22
7.2.200.0000.01415.12
7.2.190.0140.00314.71
7.2.180.0030.00614.86
7.2.170.0090.00615.16
7.2.160.0070.00715.20
7.2.150.0030.01416.76
7.2.140.0000.01216.91
7.2.130.0070.00716.85
7.2.120.0040.01016.94
7.2.110.0050.00616.86
7.2.100.0070.00816.93
7.2.90.0060.00316.89
7.2.80.0080.00816.61
7.2.70.0080.00616.83
7.2.60.0060.00816.93
7.2.50.0050.00917.01
7.2.40.0030.01117.04
7.2.30.0100.00516.91
7.2.20.0040.00916.81
7.2.10.0070.00816.93
7.2.00.0070.00617.67
7.1.330.0060.01015.80
7.1.320.0000.00915.88
7.1.310.0030.00915.86
7.1.300.0040.00815.80
7.1.290.0100.00315.54
7.1.280.0000.01315.68
7.1.270.0100.00315.81
7.1.260.0060.00315.68
7.1.250.0050.01115.74
7.1.240.0040.00415.73
7.1.230.0000.01015.63
7.1.220.0070.00715.56
7.1.210.0000.01715.57
7.1.200.0050.00615.84
7.1.190.0060.00615.71
7.1.180.0070.01015.57
7.1.170.0080.00315.62
7.1.160.0060.00615.69
7.1.150.0030.01015.99
7.1.140.0000.00915.60
7.1.130.0000.01415.63
7.1.120.0040.00815.52
7.1.110.0030.00715.91
7.1.100.0070.00716.69
7.1.90.0090.00615.62
7.1.80.0070.00715.82
7.1.70.0030.00716.47
7.1.60.0070.00917.49
7.1.50.0040.00916.36
7.1.40.0040.01115.59
7.1.30.0060.00615.48
7.1.20.0070.00715.94
7.1.10.0040.01115.76
7.1.00.0090.03618.96
7.0.330.0030.01015.43
7.0.320.0070.00715.14
7.0.310.0090.00315.50
7.0.300.0030.00615.47
7.0.290.0030.00715.27
7.0.280.0050.00515.42
7.0.270.0040.01115.39
7.0.260.0040.00815.67
7.0.250.0030.01015.48
7.0.240.0060.00615.42
7.0.230.0000.01715.62
7.0.220.0070.00715.45
7.0.210.0030.00615.15
7.0.200.0090.00416.00
7.0.190.0070.01015.52
7.0.180.0030.01315.66
7.0.170.0000.01115.46
7.0.160.0050.00515.52
7.0.150.0040.00815.27
7.0.140.0020.04418.60
7.0.130.0070.00315.30
7.0.120.0030.00615.47
7.0.110.0030.00715.33
7.0.100.0090.00015.55
7.0.90.0130.00015.19
7.0.80.0100.00315.51
7.0.70.0030.01015.65
7.0.60.0090.04517.60
7.0.50.0090.01816.69
7.0.40.0080.03516.97
7.0.30.0250.02316.73
7.0.20.0190.03116.90
7.0.10.0070.02816.88
7.0.00.0030.03016.79
5.6.400.0050.00514.64
5.6.390.0060.01014.06
5.6.380.0030.00914.59
5.6.370.0060.00314.53
5.6.360.0040.00714.23
5.6.350.0130.00314.23
5.6.340.0070.00714.23
5.6.330.0070.01014.52
5.6.320.0110.00414.57
5.6.310.0030.00714.39
5.6.300.0090.00014.43
5.6.290.0040.00714.79
5.6.280.0090.03517.62
5.6.270.0030.00714.30
5.6.260.0040.01114.32
5.6.250.0070.00314.14
5.6.240.0070.00714.27
5.6.230.0030.00614.41
5.6.220.0100.00314.30
5.6.210.0050.02517.58
5.6.200.0020.02516.33
5.6.190.0050.04117.50
5.6.180.0150.04017.35
5.6.170.0150.04017.44
5.6.160.0060.03617.47
5.6.150.0060.02616.36
5.6.140.0040.02316.22
5.6.130.0030.03716.30
5.6.120.0090.03017.82
5.6.110.0080.03817.80
5.6.100.0070.04517.65
5.6.90.0080.03317.64
5.6.80.0080.04017.33
5.6.70.0100.00314.33
5.6.60.0030.01014.43
5.6.50.0110.00414.25
5.6.40.0110.00414.36
5.6.30.0000.01014.26
5.6.20.0160.00014.01
5.6.10.0120.00414.63
5.6.00.0040.01114.44
5.5.380.0070.00314.02
5.5.370.0090.00614.38
5.5.360.0030.00614.42
5.5.350.0120.02017.36
5.5.340.0030.03016.16
5.5.330.0110.04017.34
5.5.320.0220.02017.14
5.5.310.0180.03317.35
5.5.300.0070.02416.29
5.5.290.0090.02516.12
5.5.280.0090.04717.67
5.5.270.0100.02617.61
5.5.260.0060.02517.70
5.5.250.0120.03717.46
5.5.240.0180.02817.19
5.5.230.0070.00314.11
5.5.220.0110.00314.33
5.5.210.0040.01114.25
5.5.200.0040.01114.41
5.5.190.0030.01314.38
5.5.180.0110.00614.11
5.5.170.0040.00814.39
5.5.160.0090.00614.38
5.5.150.0000.01314.14
5.5.140.0030.01314.18
5.5.130.0000.01314.03
5.5.120.0040.01114.42
5.5.110.0130.00314.21
5.5.100.0100.00714.18
5.5.90.0030.00614.39
5.5.80.0030.01014.20
5.5.70.0040.00414.64
5.5.60.0060.00314.09
5.5.50.0090.00314.32
5.5.40.0080.00614.54
5.5.30.0110.00014.31
5.5.20.0090.00614.59
5.5.10.0070.00714.04
5.5.00.0080.00414.03
5.4.450.0430.03515.19
5.4.440.0380.02715.27
5.4.430.0300.03015.34
5.4.420.0330.00315.09
5.4.410.0340.00115.18
5.4.400.0360.00115.04
5.4.390.0300.00615.14
5.4.380.0380.00015.06
5.4.370.0370.00415.10
5.4.360.0320.00515.19
5.4.350.0380.00315.11
5.4.340.0070.02011.64
5.4.330.0070.00710.95
5.4.320.0080.02011.86
5.4.310.0060.02011.81
5.4.300.0040.02311.66
5.4.290.0040.02511.79
5.4.280.0070.01911.68
5.4.270.0090.01611.80
5.4.260.0050.02411.73
5.4.250.0040.02011.73
5.4.240.0070.01811.51
5.4.230.0040.02011.86
5.4.220.0040.02111.75
5.4.210.0070.01911.84
5.4.200.0030.02211.71
5.4.190.0110.01611.68
5.4.180.0020.02411.63
5.4.170.0070.02111.74
5.4.160.0090.01811.73
5.4.150.0030.02311.76
5.4.140.0020.02411.43
5.4.130.0030.02211.46
5.4.120.0090.01711.56
5.4.110.0050.01911.62
5.4.100.0060.02311.59
5.4.90.0060.01911.53
5.4.80.0060.01911.61
5.4.70.0050.02111.62
5.4.60.0040.02211.47
5.4.50.0040.02611.62
5.4.40.0040.02111.53
5.4.30.0050.02211.54
5.4.20.0070.01611.63
5.4.10.0070.02011.65
5.4.00.0050.02111.21
5.3.290.0070.03912.80
5.3.280.0060.03712.71
5.3.270.0030.04212.72
5.3.260.0060.03912.72
5.3.250.0050.04512.72
5.3.240.0080.03612.71
5.3.230.0020.04112.71
5.3.220.0080.03812.68
5.3.210.0070.04012.68
5.3.200.0020.03912.68
5.3.190.0060.03712.68
5.3.180.0100.03712.67
5.3.170.0090.03412.67
5.3.160.0060.03612.67
5.3.150.0050.03712.68
5.3.140.0050.03712.66
5.3.130.0070.03912.66
5.3.120.0040.04012.66
5.3.110.0060.03812.65
5.3.100.0060.03612.13
5.3.90.0070.03412.11
5.3.80.0050.03812.10
5.3.70.0070.03512.09
5.3.60.0040.03812.08
5.3.50.0050.03712.03
5.3.40.0060.03612.03
5.3.30.0070.03411.98
5.3.20.0060.03411.77
5.3.10.0050.03411.74
5.3.00.0030.03711.72
5.2.170.0090.0299.23
5.2.160.0060.0289.23
5.2.150.0040.0329.23
5.2.140.0060.0309.22
5.2.130.0030.0319.18
5.2.120.0060.0279.18
5.2.110.0070.0259.19
5.2.100.0040.0289.18
5.2.90.0070.0269.18
5.2.80.0050.0299.18
5.2.70.0050.0299.18
5.2.60.0050.0349.14
5.2.50.0040.0399.11
5.2.40.0010.0359.09
5.2.30.0050.0289.05
5.2.20.0070.0259.05
5.2.10.0070.0288.95
5.2.00.0080.0268.81
5.1.60.0050.0298.09
5.1.50.0030.0268.09
5.1.40.0030.0248.08
5.1.30.0050.0328.42
5.1.20.0050.0248.44
5.1.10.0070.0228.16
5.1.00.0030.0268.17
5.0.50.0010.0226.64
5.0.40.0010.0216.51
5.0.30.0060.0286.31
5.0.20.0060.0186.28
5.0.10.0030.0246.26
5.0.00.0030.0306.25
4.4.90.0020.0154.78
4.4.80.0030.0154.75
4.4.70.0040.0144.76
4.4.60.0030.0214.75
4.4.50.0040.0134.77
4.4.40.0030.0244.70
4.4.30.0010.0174.76
4.4.20.0000.0174.85
4.4.10.0010.0174.85
4.4.00.0030.0244.76
4.3.110.0030.0224.67
4.3.100.0010.0164.66
4.3.90.0030.0144.64
4.3.80.0040.0254.58
4.3.70.0040.0134.63
4.3.60.0010.0164.63
4.3.50.0030.0154.63
4.3.40.0030.0234.54
4.3.30.0010.0163.28
4.3.20.0020.0153.26
4.3.10.0030.0143.22
4.3.00.0130.0277.21

preferences:
37.07 ms | 401 KiB | 5 Q