3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait toArray { public function toArray() { return get_object_vars($this); } public function fromArray(array $properties) { foreach ($properties as $key => $value) { if (method_exists($this, 'set' . ucfirst($key))) { $this->{'set' . ucfirst($key)}($value); } } } } interface BazInterface { } class Bazz implements BazInterface { } interface FooInterface { public function add(BazInterface $baz); public function toArray(); public function fromArray(array $properties); } class Foo implements FooInterface { use toArray; private $bar; private $baz; public function setBar($bar) { $this->bar = $bar; return $this; } public function setBaz($baz) { $this->baz = $baz; return $this; } } $foo = new Foo; $foo->fromArray(['bar' => 'boo', 'baz' => 'test']); $fooArray = $foo->toArray(); var_export($fooArray);

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.0100.01018.68
8.3.50.0070.01221.08
8.3.40.0120.00318.44
8.3.30.0100.00318.71
8.3.20.0080.00020.20
8.3.10.0040.00421.90
8.3.00.0070.00420.39
8.2.180.0000.01516.75
8.2.170.0170.00322.96
8.2.160.0030.01020.38
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0060.00317.75
8.2.110.0060.00322.22
8.2.100.0090.00317.63
8.2.90.0030.00619.05
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0080.00017.80
8.2.50.0000.00918.07
8.2.40.0040.00419.16
8.2.30.0000.00822.32
8.2.20.0040.00417.68
8.2.10.0040.00418.07
8.2.00.0000.00718.07
8.1.280.0070.01025.92
8.1.270.0140.00723.88
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0030.00622.46
8.1.230.0080.00417.42
8.1.220.0080.00017.74
8.1.210.0000.00918.77
8.1.200.0040.00417.35
8.1.190.0050.00317.10
8.1.180.0020.00518.10
8.1.170.0030.00518.66
8.1.160.0040.00421.94
8.1.150.0000.00718.89
8.1.140.0040.00417.41
8.1.130.0070.00017.57
8.1.120.0070.00017.30
8.1.110.0050.00317.28
8.1.100.0000.00717.40
8.1.90.0080.00417.43
8.1.80.0000.00717.42
8.1.70.0030.00317.30
8.1.60.0050.00317.52
8.1.50.0050.00317.33
8.1.40.0000.00817.50
8.1.30.0040.00417.61
8.1.20.0040.00417.62
8.1.10.0000.00817.43
8.1.00.0040.00417.34
8.0.300.0000.00818.77
8.0.290.0050.00316.75
8.0.280.0000.00718.27
8.0.270.0080.00017.21
8.0.260.0030.00317.12
8.0.250.0040.00416.88
8.0.240.0040.00416.86
8.0.230.0000.00716.98
8.0.220.0000.00716.95
8.0.210.0040.00416.89
8.0.200.0040.00716.96
8.0.190.0040.00416.96
8.0.180.0000.00716.91
8.0.170.0000.00716.95
8.0.160.0030.00316.98
8.0.150.0000.00716.91
8.0.140.0040.00416.85
8.0.130.0030.00313.29
8.0.120.0040.00416.84
8.0.110.0030.00516.83
8.0.100.0040.00416.86
8.0.90.0040.00416.93
8.0.80.0030.01216.96
8.0.70.0000.00716.93
8.0.60.0040.00416.71
8.0.50.0040.00416.96
8.0.30.0090.00916.93
8.0.20.0120.00717.40
8.0.10.0040.00416.97
8.0.00.0120.00716.75
7.4.330.0060.00015.08
7.4.320.0000.00616.61
7.4.300.0040.00416.61
7.4.290.0040.00416.39
7.4.280.0040.00416.45
7.4.270.0060.00016.41
7.4.260.0070.00016.54
7.4.250.0000.00716.56
7.4.240.0030.00516.46
7.4.230.0030.00316.27
7.4.220.0030.01316.64
7.4.210.0070.00716.57
7.4.200.0000.00816.30
7.4.160.0150.00616.33
7.4.150.0090.01517.40
7.4.140.0100.01017.86
7.4.130.0110.00616.58
7.4.120.0110.00816.51
7.4.110.0100.00716.53
7.4.100.0060.00916.37
7.4.90.0040.01616.65
7.4.80.0120.00619.39
7.4.70.0100.00716.68
7.4.60.0100.00716.49
7.4.50.0080.00016.63
7.4.40.0100.00716.32
7.4.30.0090.01216.32
7.4.00.0110.00414.73
7.3.330.0050.00013.25
7.3.320.0050.00013.07
7.3.310.0060.00016.30
7.3.300.0030.00316.24
7.3.290.0060.00916.25
7.3.280.0070.01116.23
7.3.270.0220.00417.40
7.3.260.0120.00616.45
7.3.250.0110.00816.31
7.3.240.0070.01116.45
7.3.230.0170.00016.39
7.3.210.0130.00316.44
7.3.200.0140.00316.42
7.3.190.0100.00716.27
7.3.180.0070.01016.37
7.3.170.0120.00616.37
7.3.160.0070.01016.16
7.2.330.0070.01016.41
7.2.320.0100.00716.60
7.2.310.0060.00916.49
7.2.300.0100.01016.43
7.2.290.0100.00716.34
7.2.60.0120.00316.41
7.2.00.0030.00919.16
7.1.200.0030.01015.36
7.1.100.0070.00418.10
7.1.70.0180.00617.10
7.1.60.0130.01019.29
7.1.50.0070.01416.83
7.1.00.0030.07722.48
7.0.200.0000.00816.56
7.0.70.4230.03319.86
7.0.60.0000.06320.04
7.0.50.0070.06317.85
7.0.40.0270.04020.04
7.0.30.0270.03720.21
7.0.20.0270.03320.23
7.0.10.0330.06720.33
7.0.00.0100.04020.11
5.6.280.0030.03321.09
5.6.210.0030.06320.48
5.6.200.0130.08018.28
5.6.190.0100.08320.57
5.6.180.0130.06320.38
5.6.170.0170.04020.39
5.6.160.0100.07720.47
5.6.150.0170.07318.16
5.6.140.0030.04718.24
5.6.130.0000.09018.32
5.6.120.0130.07721.13
5.6.110.0170.04321.12
5.6.100.0070.08321.12
5.6.90.0000.04721.14
5.6.80.0030.04320.38
5.6.70.0200.07320.53
5.5.350.0070.08320.54
5.5.340.0070.06017.99
5.5.330.0030.06720.13
5.5.320.0030.08320.31
5.5.310.0330.05720.26
5.5.300.0030.04317.94
5.5.290.0200.06717.95
5.5.280.0130.04320.91
5.5.270.0100.08020.66
5.5.260.0130.07320.88
5.5.250.0200.07720.59
5.5.240.0130.05720.16
5.4.450.0270.05719.45
5.4.440.0230.05719.60
5.4.430.0300.05319.30
5.4.420.0270.05719.59
5.4.410.0330.04719.07
5.4.400.0270.07019.06
5.4.390.0430.06018.87
5.4.380.0130.06318.87
5.4.370.0230.05319.29
5.4.360.0270.05318.98
5.4.350.0230.05319.37
5.4.340.0300.07719.14
5.4.320.0330.05318.98
5.4.310.0300.04718.87
5.4.300.0130.06319.27
5.4.290.0270.05319.21
5.4.280.0300.05719.14
5.4.270.0400.04319.19
5.4.260.0200.06019.13
5.4.250.0230.05019.13
5.4.240.0270.04719.13
5.4.230.0270.05719.34
5.4.220.0370.05719.07
5.4.210.0470.05019.14
5.4.200.0270.06319.00
5.4.190.0470.07719.13
5.4.180.0370.06319.12
5.4.170.0300.05019.14
5.4.160.0200.06019.25
5.4.150.0270.05319.26
5.4.140.0200.05716.43
5.4.130.0170.05716.36
5.4.120.0230.05316.74
5.4.110.0300.05316.57
5.4.100.0270.04716.64
5.4.90.0330.05316.56
5.4.80.0200.05316.61
5.4.70.0000.03716.62
5.4.60.0070.04016.48
5.4.50.0030.05016.53
5.4.40.0030.06016.26
5.4.30.0070.07016.17
5.4.20.0270.03316.54
5.4.10.0330.06316.54

preferences:
61.66 ms | 401 KiB | 5 Q