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 (property_exists($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.0150.00618.31
8.3.50.0100.01122.01
8.3.40.0140.00718.87
8.3.30.0170.00319.22
8.3.20.0040.00420.16
8.3.10.0050.00323.66
8.3.00.0080.00019.38
8.2.180.0090.00618.50
8.2.170.0090.00622.96
8.2.160.0150.00020.52
8.2.150.0070.00024.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0030.00621.86
8.2.110.0040.00422.07
8.2.100.0110.00017.75
8.2.90.0000.00819.26
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0050.00317.80
8.2.50.0000.00918.07
8.2.40.0030.00618.16
8.2.30.0070.00018.13
8.2.20.0040.00417.82
8.2.10.0040.00418.07
8.2.00.0080.00017.80
8.1.280.0070.01025.92
8.1.270.0040.00422.22
8.1.260.0000.00726.35
8.1.250.0000.00828.09
8.1.240.0000.00823.84
8.1.230.0090.00319.13
8.1.220.0060.00317.88
8.1.210.0050.00318.77
8.1.200.0060.00317.48
8.1.190.0000.00817.34
8.1.180.0040.00418.10
8.1.170.0070.00318.45
8.1.160.0000.00822.14
8.1.150.0050.00218.95
8.1.140.0040.00417.51
8.1.130.0000.00717.89
8.1.120.0070.00017.46
8.1.110.0040.00417.56
8.1.100.0040.00417.41
8.1.90.0040.00417.53
8.1.80.0040.00417.56
8.1.70.0040.00417.41
8.1.60.0000.01017.64
8.1.50.0030.00617.62
8.1.40.0040.00417.59
8.1.30.0030.00617.55
8.1.20.0060.00317.63
8.1.10.0040.00417.54
8.1.00.0000.00817.55
8.0.300.0000.00718.77
8.0.290.0050.00216.88
8.0.280.0000.00718.41
8.0.270.0000.00717.32
8.0.260.0050.00317.37
8.0.250.0000.00716.96
8.0.240.0030.00517.13
8.0.230.0000.00817.07
8.0.220.0070.00016.99
8.0.210.0000.00816.93
8.0.200.0050.00317.05
8.0.190.0070.00016.98
8.0.180.0020.00516.93
8.0.170.0040.00417.08
8.0.160.0040.00416.99
8.0.150.0020.00516.80
8.0.140.0040.00416.89
8.0.130.0060.00013.46
8.0.120.0030.00516.96
8.0.110.0050.00317.04
8.0.100.0050.00216.81
8.0.90.0050.00316.93
8.0.80.0030.00416.94
8.0.70.0000.00817.06
8.0.60.0040.00416.96
8.0.50.0030.00516.91
8.0.30.0160.00617.16
8.0.20.0090.01117.40
8.0.10.0000.00717.14
8.0.00.0080.01016.84
7.4.330.0000.00515.00
7.4.320.0050.00216.62
7.4.300.0030.00316.51
7.4.290.0040.00416.64
7.4.280.0000.01016.60
7.4.270.0030.00316.63
7.4.260.0000.00716.69
7.4.250.0040.00416.61
7.4.240.0020.00516.59
7.4.230.0030.00316.73
7.4.220.0100.00716.58
7.4.210.0060.00916.74
7.4.200.0080.00016.77
7.4.160.0130.00316.59
7.4.150.0120.00617.40
7.4.140.0140.00817.86
7.4.130.0110.01116.69
7.4.120.0080.01116.64
7.4.110.0060.01216.68
7.4.100.0060.01616.66
7.4.90.0090.01216.43
7.4.80.0100.01319.39
7.4.70.0080.01116.55
7.4.60.0080.00816.41
7.4.50.0030.00516.29
7.4.40.0070.01016.54
7.4.30.0100.00716.50
7.4.00.0110.00615.00
7.3.330.0050.00013.36
7.3.320.0020.00213.42
7.3.310.0000.00716.36
7.3.300.0040.00416.41
7.3.290.0080.00816.35
7.3.280.0050.01016.42
7.3.270.0080.01117.40
7.3.260.0060.01516.51
7.3.250.0140.00816.55
7.3.240.0130.00616.39
7.3.230.0030.01516.68
7.3.210.0090.01016.41
7.3.200.0120.00619.39
7.3.190.0130.01016.48
7.3.180.0130.00316.70
7.3.170.0090.01316.44
7.3.160.0080.00816.48
7.3.120.0060.01314.77
7.3.110.0040.01415.19
7.3.100.0040.01214.93
7.3.90.0030.01014.77
7.3.80.0060.00915.00
7.3.70.0000.01014.86
7.3.60.0000.01614.97
7.3.50.0070.00714.93
7.3.40.0070.00714.66
7.3.30.0060.00914.72
7.3.20.0040.01516.64
7.3.10.0000.01016.88
7.3.00.0070.00416.65
7.2.330.0090.00916.61
7.2.320.0060.01116.93
7.2.310.0100.00716.89
7.2.300.0100.01316.60
7.2.290.0140.00316.79
7.2.250.0070.01315.13
7.2.240.0060.01215.39
7.2.230.0070.00715.03
7.2.220.0070.01014.78
7.2.210.0050.00515.29
7.2.200.0070.01014.83
7.2.190.0000.01515.20
7.2.180.0100.00615.08
7.2.170.0130.00315.25
7.2.160.0080.01115.27
7.2.150.0100.00717.06
7.2.140.0030.01317.01
7.2.130.0000.01217.06
7.2.120.0060.01017.02
7.2.110.0090.00616.77
7.2.100.0030.01317.11
7.2.90.0030.01016.92
7.2.80.0030.01016.99
7.2.70.0070.00717.07
7.2.60.0030.01016.94
7.2.50.0100.00317.04
7.2.40.0030.00616.92
7.2.30.0040.01116.99
7.2.20.0040.01116.85
7.2.10.0090.00316.96
7.2.00.0000.01317.04
7.1.330.0070.01015.95
7.1.320.0070.00715.73
7.1.310.0070.00715.65
7.1.300.0060.00315.78
7.1.290.0040.01215.72
7.1.280.0030.01315.55
7.1.270.0000.01815.66
7.1.260.0030.00915.82
7.1.250.0100.00315.77
7.1.240.0090.00015.48
7.1.230.0040.00715.73
7.1.220.0070.00715.86
7.1.210.0110.00315.70
7.1.200.0020.00615.96
7.1.190.0030.00515.65
7.1.180.0070.00715.66
7.1.170.0120.00315.78
7.1.160.0070.00315.84
7.1.150.0060.00915.65
7.1.140.0090.00615.88
7.1.130.0110.00416.04
7.1.120.0060.00615.85
7.1.110.0070.01015.92
7.1.100.0080.00815.93
7.1.90.0040.00815.68
7.1.80.0030.00915.67
7.1.70.0040.00816.50
7.1.60.0100.00717.59
7.1.50.0050.00916.26
7.1.40.0060.00315.72
7.1.30.0000.01115.89
7.1.20.0000.01215.88
7.1.10.0060.01215.53
7.1.00.0070.04019.04
7.0.330.0030.00715.29
7.0.320.0040.01115.41
7.0.310.0050.00315.37
7.0.300.0070.00715.46
7.0.290.0050.00415.34
7.0.280.0120.00315.46
7.0.270.0000.00815.57
7.0.260.0060.00615.42
7.0.250.0040.01115.42
7.0.240.0030.00915.42
7.0.230.0060.00615.55
7.0.220.0040.00815.54
7.0.210.0000.01015.33
7.0.200.0070.00516.11
7.0.190.0040.00415.39
7.0.180.0040.00815.25
7.0.170.0090.00615.30
7.0.160.0030.00615.28
7.0.150.0130.00315.24
7.0.140.0060.04018.86
7.0.130.0040.00415.11
7.0.120.0060.00915.56
7.0.110.0070.01015.21
7.0.100.0090.00915.47
7.0.90.0070.01015.50
7.0.80.0030.00615.41
7.0.70.0080.00315.40
7.0.60.0020.02717.76
7.0.50.0030.02816.81
7.0.40.0140.04016.81
7.0.30.0260.02616.70
7.0.20.0120.04416.81
7.0.10.0080.04616.86
7.0.00.0050.02816.89
5.6.400.0040.01114.58
5.6.390.0040.00714.44
5.6.380.0060.00314.23
5.6.370.0110.00014.69
5.6.360.0060.01014.66
5.6.350.0030.01014.58
5.6.340.0000.00814.32
5.6.330.0070.00714.78
5.6.320.0090.00614.58
5.6.310.0030.01314.54
5.6.300.0060.00914.42
5.6.290.0070.01014.45
5.6.280.0070.03717.72
5.6.270.0040.00414.78
5.6.260.0060.01014.17
5.6.250.0070.00714.38
5.6.240.0030.01214.29
5.6.230.0030.01014.79
5.6.220.0060.00614.52
5.6.210.0040.02417.53
5.6.200.0030.02516.39
5.6.190.0050.02617.54
5.6.180.0210.04017.37
5.6.170.0350.02817.51
5.6.160.0050.05117.37
5.6.150.0070.02416.24
5.6.140.0080.02516.42
5.6.130.0070.02716.33
5.6.120.0100.03017.65
5.6.110.0110.04517.66
5.6.100.0050.04717.62
5.6.90.0070.03317.68
5.6.80.0030.04517.46
5.6.70.0060.00614.22
5.6.60.0060.00614.57
5.6.50.0000.01314.62
5.6.40.0070.00714.21
5.6.30.0040.01114.23
5.6.20.0060.00614.61
5.6.10.0030.00814.50
5.6.00.0070.00314.16
5.5.380.0060.00314.38
5.5.370.0060.00614.12
5.5.360.0070.00314.48
5.5.350.0060.02617.49
5.5.340.0080.02816.05
5.5.330.0130.02117.48
5.5.320.0180.04017.37
5.5.310.0160.02617.31
5.5.300.0080.03116.23
5.5.290.0060.02816.13
5.5.280.0080.03017.81
5.5.270.0070.04517.54
5.5.260.0050.02217.50
5.5.250.0070.02717.44
5.5.240.0150.02317.15
5.5.230.0110.00714.40
5.5.220.0060.01014.32
5.5.210.0110.00314.29
5.5.200.0030.01014.13
5.5.190.0060.00914.39
5.5.180.0030.00914.33
5.5.170.0070.00714.44
5.5.160.0000.00914.14
5.5.150.0060.00614.11
5.5.140.0030.00914.19
5.5.130.0030.00614.31
5.5.120.0080.00314.29
5.5.110.0060.00914.46
5.5.100.0000.00913.94
5.5.90.0030.00914.06
5.5.80.0100.00014.37
5.5.70.0030.01414.05
5.5.60.0060.00814.41
5.5.50.0060.00314.10
5.5.40.0090.00614.40
5.5.30.0030.00614.11
5.5.20.0040.00714.63
5.5.10.0110.00414.38
5.5.00.0130.00314.44
5.4.450.0050.03715.92
5.4.440.0350.03215.97
5.4.430.0530.03515.99
5.4.420.0360.00215.91
5.4.410.0390.00015.81
5.4.400.0340.00415.73
5.4.390.0320.00515.80
5.4.380.0360.00015.74
5.4.370.0330.00315.73
5.4.360.0430.00415.80
5.4.350.0330.00215.79
5.4.340.0050.01912.20
5.4.330.0000.01312.36
5.4.320.0050.02012.44
5.4.310.0050.02112.44
5.4.300.0070.01812.44
5.4.290.0040.02412.44
5.4.280.0050.02012.39
5.4.270.0040.02212.39
5.4.260.0050.02112.39
5.4.250.0030.02412.39
5.4.240.0040.02612.39
5.4.230.0040.02312.38
5.4.220.0040.03112.38
5.4.210.0080.02612.38
5.4.200.0080.02112.38
5.4.190.0020.02212.38
5.4.180.0040.02312.38
5.4.170.0030.02412.39
5.4.160.0060.02112.38
5.4.150.0100.01812.38
5.4.140.0040.02212.22
5.4.130.0050.02112.22
5.4.120.0070.01912.20
5.4.110.0060.01912.20
5.4.100.0040.02012.19
5.4.90.0090.01812.20
5.4.80.0060.02012.20
5.4.70.0020.02212.20
5.4.60.0080.01912.19
5.4.50.0020.02512.19
5.4.40.0020.02312.19
5.4.30.0050.02212.19
5.4.20.0060.02112.19
5.4.10.0060.02112.19
5.4.00.0070.02111.93
5.3.290.0070.03912.80
5.3.280.0060.03612.71
5.3.270.0050.04012.73
5.3.260.0050.03812.72
5.3.250.0050.03712.72
5.3.240.0050.03812.72
5.3.230.0040.03812.71
5.3.220.0050.03712.68
5.3.210.0030.04212.68
5.3.200.0070.03412.68
5.3.190.0060.03612.68
5.3.180.0070.03412.68
5.3.170.0020.03912.66
5.3.160.0040.03912.68
5.3.150.0040.03812.67
5.3.140.0080.03312.66
5.3.130.0050.03912.66
5.3.120.0040.04012.65
5.3.110.0020.04112.66
5.3.100.0080.03412.13
5.3.90.0050.03712.11
5.3.80.0040.03712.10
5.3.70.0070.03612.09
5.3.60.0060.03512.08
5.3.50.0050.03612.03
5.3.40.0040.03812.03
5.3.30.0020.04711.99
5.3.20.0060.03911.77
5.3.10.0090.03311.74
5.3.00.0080.03511.72
5.2.170.0040.0349.22
5.2.160.0030.0319.22
5.2.150.0080.0339.22
5.2.140.0010.0349.22
5.2.130.0060.0309.18
5.2.120.0040.0329.18
5.2.110.0030.0329.19
5.2.100.0050.0339.18
5.2.90.0050.0309.18
5.2.80.0050.0329.18
5.2.70.0020.0329.18
5.2.60.0030.0329.14
5.2.50.0050.0319.11
5.2.40.0040.0289.08
5.2.30.0040.0299.05
5.2.20.0060.0319.04
5.2.10.0030.0298.95
5.2.00.0040.0318.81
5.1.60.0020.0258.10
5.1.50.0040.0248.09
5.1.40.0040.0248.08
5.1.30.0030.0268.43
5.1.20.0080.0228.44
5.1.10.0050.0258.17
5.1.00.0000.0308.17
5.0.50.0040.0206.64
5.0.40.0030.0206.50
5.0.30.0050.0306.31
5.0.20.0020.0206.28
5.0.10.0010.0216.26
5.0.00.0050.0286.25
4.4.90.0040.0144.78
4.4.80.0020.0164.75
4.4.70.0020.0154.75
4.4.60.0030.0154.76
4.4.50.0030.0154.77
4.4.40.0030.0244.71
4.4.30.0010.0174.76
4.4.20.0030.0154.85
4.4.10.0020.0164.85
4.4.00.0030.0264.76
4.3.110.0030.0154.67
4.3.100.0000.0174.67
4.3.90.0040.0144.63
4.3.80.0040.0234.58
4.3.70.0030.0154.63
4.3.60.0000.0174.63
4.3.50.0030.0144.63
4.3.40.0030.0234.54
4.3.30.0020.0183.29
4.3.20.0010.0203.26
4.3.10.0000.0173.22
4.3.00.0170.0207.21

preferences:
39.44 ms | 401 KiB | 5 Q