3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DataTransferObject { public static function fromParams(array $params); public function asArray(); } trait DataTransferTrait { private static $mutable = true; 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 (self::mutable == true && 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.43
8.3.50.0130.01021.14
8.3.40.0110.00418.82
8.3.30.0150.00619.11
8.3.20.0040.00420.34
8.3.10.0080.00021.90
8.3.00.0060.00319.25
8.2.180.0000.01516.63
8.2.170.0140.00022.96
8.2.160.0070.00720.57
8.2.150.0070.00724.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00422.25
8.2.110.0070.00422.16
8.2.100.0000.01217.75
8.2.90.0060.00319.23
8.2.80.0050.00317.97
8.2.70.0060.00317.75
8.2.60.0050.00318.03
8.2.50.0030.00618.07
8.2.40.0030.00918.22
8.2.30.0000.00818.03
8.2.20.0070.00017.84
8.2.10.0070.00018.13
8.2.00.0030.00617.65
8.1.280.0030.01425.92
8.1.270.0030.00522.24
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00317.25
8.1.230.0060.00619.13
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.25
8.1.180.0030.00518.10
8.1.170.0050.00318.65
8.1.160.0050.00322.07
8.1.150.0020.00518.86
8.1.140.0060.00317.43
8.1.130.0000.00717.78
8.1.120.0070.00017.46
8.1.110.0040.00417.45
8.1.100.0080.00017.53
8.1.90.0040.00417.46
8.1.80.0050.00217.38
8.1.70.0000.00717.51
8.1.60.0000.01017.66
8.1.50.0000.00817.57
8.1.40.0050.00517.54
8.1.30.0030.00617.70
8.1.20.0090.00017.61
8.1.10.0000.00817.54
8.1.00.0040.00417.43
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00318.44
8.0.270.0030.00317.25
8.0.260.0040.00417.30
8.0.250.0000.00717.08
8.0.240.0040.00417.05
8.0.230.0000.00617.03
8.0.220.0080.00016.99
8.0.210.0000.00716.92
8.0.200.0030.00317.12
8.0.190.0000.00817.09
8.0.180.0040.00417.02
8.0.170.0040.00416.97
8.0.160.0000.00717.02
8.0.150.0000.00716.82
8.0.140.0050.00216.89
8.0.130.0000.00613.44
8.0.120.0040.00417.01
8.0.110.0050.00216.90
8.0.100.0000.00716.86
8.0.90.0040.00417.06
8.0.80.0100.00616.96
8.0.70.0030.00516.93
8.0.60.0070.00016.97
8.0.50.0030.00617.00
8.0.30.0080.01317.20
8.0.20.0100.00917.40
8.0.10.0050.00317.00
8.0.00.0060.01216.88
7.4.330.0000.00515.00
7.4.320.0030.00316.67
7.4.300.0000.00616.55
7.4.290.0040.00416.65
7.4.280.0120.00016.54
7.4.270.0070.00016.55
7.4.260.0040.00416.46
7.4.250.0030.00516.55
7.4.240.0050.00216.64
7.4.230.0070.00016.33
7.4.220.0090.00916.50
7.4.210.0070.00716.72
7.4.200.0030.00316.75
7.4.160.0100.00616.48
7.4.150.0150.00317.40
7.4.140.0100.00917.86
7.4.130.0120.00816.61
7.4.120.0080.00816.52
7.4.110.0170.00016.47
7.4.100.0100.01016.54
7.4.90.0120.00416.48
7.4.80.0120.00919.39
7.4.70.0130.00316.51
7.4.60.0100.01016.53
7.4.50.0040.00416.63
7.4.40.0070.01016.57
7.4.30.0100.00716.41
7.4.10.0070.01015.56
7.4.00.0120.00615.26
7.3.330.0020.00213.17
7.3.320.0000.00613.23
7.3.310.0070.00016.28
7.3.300.0000.00716.39
7.3.290.0090.00916.46
7.3.280.0080.00816.38
7.3.270.0070.01417.40
7.3.260.0110.01216.45
7.3.250.0060.01116.54
7.3.240.0150.00816.34
7.3.230.0040.01316.54
7.3.210.0100.00716.52
7.3.200.0100.00719.39
7.3.190.0150.00316.45
7.3.180.0040.01216.59
7.3.170.0120.00616.36
7.3.160.0100.00616.59
7.3.130.0080.00715.29
7.3.120.0080.00915.37
7.3.110.0030.01315.36
7.3.100.0060.01015.40
7.3.90.0050.00915.47
7.3.80.0060.00715.23
7.3.70.0080.00515.46
7.3.60.0070.01015.30
7.3.50.0030.00915.39
7.3.40.0040.00815.32
7.3.30.0080.00715.26
7.3.20.0080.00617.21
7.3.10.0070.00917.30
7.3.00.0030.00917.17
7.2.330.0100.00716.61
7.2.320.0000.01816.52
7.2.310.0030.01316.48
7.2.300.0140.01016.61
7.2.290.0170.00316.64
7.2.260.0090.00915.63
7.2.250.0090.00815.48
7.2.240.0020.01215.67
7.2.230.0090.00715.52
7.2.220.0080.00615.64
7.2.210.0050.00915.57
7.2.200.0070.00715.54
7.2.190.0060.00815.60
7.2.180.0080.00315.48
7.2.170.0040.01215.54
7.2.160.0070.00815.45
7.2.150.0040.01017.29
7.2.140.0080.00517.41
7.2.130.0050.00817.38
7.2.120.0030.01117.43
7.2.110.0060.01117.43
7.2.100.0060.00717.43
7.2.90.0070.00817.42
7.2.80.0070.00917.34
7.2.70.0070.00717.47
7.2.60.0050.00817.43
7.2.50.0060.00817.58
7.2.40.0050.01117.46
7.2.30.0020.01017.43
7.2.20.0080.00717.43
7.2.10.0040.01217.28
7.2.00.0050.00717.91
7.1.330.0030.01016.31
7.1.320.0040.00916.41
7.1.310.0090.00716.25
7.1.300.0080.00316.31
7.1.290.0040.01116.32
7.1.280.0040.00616.26
7.1.270.0060.00816.23
7.1.260.0060.00916.35
7.1.250.0080.00816.26
7.1.240.0080.00716.21
7.1.230.0060.01016.29
7.1.220.0060.00916.27
7.1.210.0050.00916.14
7.1.200.0060.01116.09
7.1.190.0050.00816.27
7.1.180.0030.00916.24
7.1.170.0070.00916.25
7.1.160.0060.00716.28
7.1.150.0080.00916.26
7.1.140.0020.01116.25
7.1.130.0050.00916.21
7.1.120.0030.00916.29
7.1.110.0090.00516.32
7.1.100.0060.00816.68
7.1.90.0080.00716.10
7.1.80.0070.00716.28
7.1.70.0040.00716.51
7.1.60.0060.00816.97
7.1.50.0070.01016.43
7.1.40.0040.01116.24
7.1.30.0040.00916.15
7.1.20.0060.00616.19
7.1.10.0080.00616.15
7.1.00.0040.02617.71
7.0.330.0060.00615.87
7.0.320.0050.00815.88
7.0.310.0050.00915.78
7.0.300.0050.00715.87
7.0.290.0090.00515.71
7.0.280.0020.01115.90
7.0.270.0090.00515.98
7.0.260.0050.00615.89
7.0.250.0060.00515.97
7.0.240.0080.00615.90
7.0.230.0030.00915.96
7.0.220.0020.01015.94
7.0.210.0040.00915.76
7.0.200.0050.00615.95
7.0.190.0020.01016.05
7.0.180.0070.00816.00
7.0.170.0090.00415.89
7.0.160.0070.00415.94
7.0.150.0090.00415.84
7.0.140.0070.02017.51
7.0.130.0060.00515.82
7.0.120.0080.00416.00
7.0.110.0030.01016.08
7.0.100.0060.00915.95
7.0.90.0030.00715.96
7.0.80.0040.00616.00
7.0.70.0050.01015.99
7.0.60.0050.02117.04
7.0.50.0060.02616.52
7.0.40.0070.02415.64
7.0.30.0180.02415.61
7.0.20.0080.01915.55
7.0.10.0050.01615.62
7.0.00.0040.01515.65
5.6.400.0070.00615.14
5.6.390.0070.00814.95
5.6.380.0050.00614.97
5.6.370.0050.00814.88
5.6.360.0070.00715.06
5.6.350.0080.00414.56
5.6.340.0030.01014.95
5.6.330.0070.00614.90
5.6.320.0010.01214.96
5.6.310.0050.00814.96
5.6.300.0080.00614.83
5.6.290.0050.00814.90
5.6.280.0060.02216.57
5.6.270.0030.00814.73
5.6.260.0030.01314.90
5.6.250.0070.00714.86
5.6.240.0050.00914.75
5.6.230.0010.01014.98
5.6.220.0060.00914.82
5.6.210.0030.01916.43
5.6.200.0050.01615.68
5.6.190.0020.02316.43
5.6.180.0100.02716.25
5.6.170.0100.01616.33
5.6.160.0080.02416.30
5.6.150.0060.02615.79
5.6.140.0050.01615.77
5.6.130.0040.01615.81
5.6.120.0050.02016.36
5.6.110.0070.02316.36
5.6.100.0090.02516.46
5.6.90.0050.02916.37
5.6.80.0050.02716.28
5.6.70.0050.00814.76
5.6.60.0050.01114.88
5.6.50.0060.00914.78
5.6.40.0040.00914.89
5.6.30.0040.00714.67
5.6.20.0060.00514.88
5.6.10.0090.00614.88
5.6.00.0050.00814.73
5.5.380.0080.00714.77
5.5.370.0060.00814.72
5.5.360.0060.00914.81
5.5.350.0070.01416.15
5.5.340.0080.02515.53
5.5.330.0120.01216.04
5.5.320.0140.02316.17
5.5.310.0120.02016.09
5.5.300.0050.02215.66
5.5.290.0070.02815.62
5.5.280.0030.02816.32
5.5.270.0050.02816.29
5.5.260.0020.01916.40
5.5.250.0090.02116.21
5.5.240.0110.02416.15
5.5.230.0100.00514.72
5.5.220.0080.00914.71
5.5.210.0060.00614.68
5.5.200.0050.00814.83
5.5.190.0040.01114.82
5.5.180.0050.00914.70
5.5.170.0040.01314.72
5.5.160.0080.00514.76
5.5.150.0040.01114.91
5.5.140.0010.01314.70
5.5.130.0050.00914.85
5.5.120.0060.00614.71
5.5.110.0060.00514.76
5.5.100.0070.00714.63
5.5.90.0050.00714.62
5.5.80.0030.01114.66
5.5.70.0050.00814.79
5.5.60.0020.01114.71
5.5.50.0060.00514.68
5.5.40.0060.01014.53
5.5.30.0060.00814.82
5.5.20.0070.00614.43
5.5.10.0060.00714.51
5.5.00.0060.00614.76
5.4.450.0170.02314.58
5.4.440.0240.01914.63
5.4.430.0260.01814.67
5.4.420.0160.00714.64
5.4.410.0220.00314.48
5.4.400.0240.00614.52
5.4.390.0180.00514.51
5.4.380.0190.00414.51
5.4.370.0170.00614.46
5.4.360.0190.00714.44
5.4.350.0210.00514.46
5.4.340.0050.01612.76
5.4.330.0070.00513.01
5.4.320.0060.01512.87
5.4.310.0050.01412.82
5.4.300.0030.01612.79
5.4.290.0030.01712.82
5.4.280.0040.01512.85
5.4.270.0020.01612.88
5.4.260.0040.01512.79
5.4.250.0060.01412.81
5.4.240.0070.01312.85
5.4.230.0060.02012.89
5.4.220.0030.01712.81
5.4.210.0080.01412.81
5.4.200.0050.01712.88
5.4.190.0050.01612.84
5.4.180.0050.01512.89
5.4.170.0050.01412.86
5.4.160.0030.01512.79
5.4.150.0040.01412.86
5.4.140.0040.01412.78
5.4.130.0050.01512.74
5.4.120.0070.01812.75
5.4.110.0060.02312.73
5.4.100.0110.02512.77
5.4.90.0070.02312.77
5.4.80.0060.02412.78
5.4.70.0060.01812.72
5.4.60.0080.02712.71
5.4.50.0070.02512.74
5.4.40.0090.01812.76
5.4.30.0060.02612.69
5.4.20.0060.01412.70
5.4.10.0050.01312.74
5.4.00.0050.01712.63
5.3.290.0060.04512.80
5.3.280.0070.03612.71
5.3.270.0090.05012.73
5.3.260.0090.04512.72
5.3.250.0100.04012.72
5.3.240.0040.04212.71
5.3.230.0070.04112.71
5.3.220.0070.04312.68
5.3.210.0120.03712.68
5.3.200.0070.04312.68
5.3.190.0050.04312.68
5.3.180.0100.03912.68
5.3.170.0060.03712.67
5.3.160.0090.04112.67
5.3.150.0060.04412.67
5.3.140.0080.05712.66
5.3.130.0070.04212.66
5.3.120.0070.04112.66
5.3.110.0090.03912.66
5.3.100.0080.04512.13
5.3.90.0090.05712.11
5.3.80.0050.03812.10
5.3.70.0060.03812.09
5.3.60.0070.04912.09
5.3.50.0060.04012.03
5.3.40.0070.03912.03
5.3.30.0120.05111.98
5.3.20.0050.04311.77
5.3.10.0040.04511.74
5.3.00.0060.05211.72
5.2.170.0110.0769.22
5.2.160.0060.0409.22
5.2.150.0100.0839.22
5.2.140.0060.0439.21
5.2.130.0080.0449.18
5.2.120.0060.0419.18
5.2.110.0080.0379.19
5.2.100.0070.0439.18
5.2.90.0070.0329.18
5.2.80.0050.0349.18
5.2.70.0030.0329.18
5.2.60.0050.0309.14
5.2.50.0050.0349.11
5.2.40.0030.0349.08
5.2.30.0050.0319.05
5.2.20.0040.0349.05
5.2.10.0070.0278.95
5.2.00.0060.0308.81
5.1.60.0060.0238.10
5.1.50.0060.0228.10
5.1.40.0060.0238.08
5.1.30.0030.0288.43
5.1.20.0040.0268.45
5.1.10.0060.0258.18
5.1.00.0060.0268.17
5.0.50.0030.0226.64
5.0.40.0020.0236.50
5.0.30.0040.0336.31
5.0.20.0050.0196.28
5.0.10.0050.0276.26
5.0.00.0050.0336.25
4.4.90.0070.0334.78
4.4.80.0130.0364.76
4.4.70.0140.0464.75
4.4.60.0070.0514.75
4.4.50.0070.0524.77
4.4.40.0040.0754.71
4.4.30.0070.0314.76
4.4.20.0110.0424.85
4.4.10.0080.0294.85
4.4.00.0040.0424.76
4.3.110.0040.0524.67
4.3.100.0060.0304.67
4.3.90.0050.0314.63
4.3.80.0030.0294.58
4.3.70.0040.0224.63
4.3.60.0100.0374.63
4.3.50.0060.0304.63
4.3.40.0060.0564.54
4.3.30.0120.0613.28
4.3.20.0050.0283.25
4.3.10.0060.0653.22
4.3.00.0000.0237.21

preferences:
47.35 ms | 401 KiB | 5 Q