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 add() { } 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.0140.00718.56
8.3.50.0130.00621.28
8.3.40.0120.00918.66
8.3.30.0110.00418.71
8.3.20.0040.00420.30
8.3.10.0000.00721.95
8.3.00.0060.00320.16
8.2.180.0110.00418.29
8.2.170.0080.00622.96
8.2.160.0100.00320.32
8.2.150.0000.00824.18
8.2.140.0020.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00817.63
8.2.110.0060.00322.20
8.2.100.0000.01117.63
8.2.90.0040.00419.05
8.2.80.0060.00317.97
8.2.70.0030.00517.50
8.2.60.0040.00417.93
8.2.50.0110.00018.07
8.2.40.0040.00419.39
8.2.30.0030.00522.52
8.2.20.0000.00817.64
8.2.10.0030.00517.92
8.2.00.0000.00717.94
8.1.280.0160.00025.92
8.1.270.0070.01423.75
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0030.00622.42
8.1.230.0040.00717.42
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0090.00017.36
8.1.190.0050.00316.98
8.1.180.0040.00418.10
8.1.170.0040.00418.73
8.1.160.0040.00421.99
8.1.150.0070.00018.84
8.1.140.0030.00517.41
8.1.130.0000.00717.53
8.1.120.0030.00317.49
8.1.110.0030.00617.41
8.1.100.0020.00517.43
8.1.90.0100.00017.48
8.1.80.0030.00317.41
8.1.70.0030.00517.30
8.1.60.0040.00417.52
8.1.50.0000.00817.45
8.1.40.0000.00817.36
8.1.30.0000.00817.68
8.1.20.0040.00417.48
8.1.10.0040.00417.30
8.1.00.0040.00417.23
8.0.300.0000.00718.77
8.0.290.0080.00016.75
8.0.280.0040.00418.43
8.0.270.0000.00817.17
8.0.260.0070.00017.22
8.0.250.0000.00716.87
8.0.240.0040.00416.87
8.0.230.0030.00316.86
8.0.220.0000.00716.82
8.0.210.0080.00016.92
8.0.200.0050.00416.95
8.0.190.0040.00416.89
8.0.180.0040.00416.95
8.0.170.0000.00716.79
8.0.160.0000.00816.93
8.0.150.0040.00416.75
8.0.140.0000.00716.80
8.0.130.0000.00713.36
8.0.120.0080.00016.90
8.0.110.0070.00016.91
8.0.100.0030.00517.02
8.0.90.0050.00216.78
8.0.80.0070.00716.86
8.0.70.0050.00216.78
8.0.60.0070.00016.98
8.0.50.0050.00316.96
8.0.30.0090.00917.02
8.0.20.0080.01217.40
8.0.10.0070.00017.03
8.0.00.0090.00816.79
7.4.330.0000.00515.08
7.4.320.0000.00616.49
7.4.300.0000.00616.46
7.4.290.0000.00816.46
7.4.280.0040.00416.50
7.4.270.0000.00716.57
7.4.260.0030.00316.42
7.4.250.0070.00016.37
7.4.240.0010.00616.46
7.4.230.0000.00716.64
7.4.220.0030.01416.48
7.4.210.0060.00916.58
7.4.200.0020.00516.31
7.4.160.0040.01816.69
7.4.150.0120.00617.40
7.4.140.0100.01017.86
7.4.130.0080.01016.45
7.4.120.0060.01116.54
7.4.110.0090.01116.48
7.4.100.0110.01216.16
7.4.90.0060.01216.38
7.4.80.0070.01119.39
7.4.70.0060.00916.41
7.4.60.0030.01316.60
7.4.50.0040.00416.31
7.4.40.0040.01416.50
7.4.30.0110.01116.58
7.4.00.0040.01315.01
7.3.330.0020.00213.28
7.3.320.0050.00013.23
7.3.310.0030.00316.26
7.3.300.0030.00316.13
7.3.290.0050.00916.26
7.3.280.0100.00716.25
7.3.270.0100.00717.40
7.3.260.0140.00316.38
7.3.250.0080.01116.41
7.3.240.0110.00716.33
7.3.230.0170.00316.39
7.3.210.0120.00616.43
7.3.200.0070.01016.52
7.3.190.0120.00616.44
7.3.180.0060.00916.44
7.3.170.0140.00816.28
7.3.160.0080.00816.27
7.3.120.0030.01614.81
7.3.110.0060.01314.81
7.3.100.0100.00014.34
7.3.90.0030.00614.77
7.3.80.0070.00414.48
7.3.70.0030.01014.70
7.3.60.0030.01114.76
7.3.50.0030.00614.83
7.3.40.0030.00814.52
7.3.30.0030.01214.83
7.3.20.0060.00916.56
7.3.10.0100.00316.56
7.3.00.0000.01316.59
7.2.330.0100.00716.49
7.2.320.0060.01816.58
7.2.310.0000.01716.48
7.2.300.0030.01416.43
7.2.290.0170.00016.28
7.2.250.0070.01414.75
7.2.240.0030.01714.61
7.2.230.0100.00614.52
7.2.220.0030.00715.10
7.2.210.0070.00715.07
7.2.200.0060.01214.73
7.2.190.0060.00614.66
7.2.180.0040.01214.78
7.2.170.0070.00714.90
7.2.130.0070.00316.58
7.2.120.0080.00316.78
7.2.110.0080.00816.93
7.2.100.0030.01016.86
7.2.90.0060.00816.89
7.2.80.0070.00716.68
7.2.70.0030.01016.90
7.2.60.0100.00816.74
7.2.50.0070.00416.61
7.2.40.0100.00316.77
7.2.30.0100.00316.86
7.2.20.0040.00816.82
7.2.10.0040.00816.83
7.2.00.0070.00517.98
7.1.330.0030.01015.62
7.1.320.0000.01115.82
7.1.310.0000.01715.61
7.1.300.0030.00915.68
7.1.290.0040.00815.64
7.1.280.0040.00715.49
7.1.270.0040.00815.31
7.1.260.0030.00915.61
7.1.250.0030.00715.41
7.1.200.0000.01015.45
7.1.100.0060.00818.16
7.1.70.0000.01117.15
7.1.60.0100.00719.29
7.1.50.0110.00716.76
7.1.00.0000.07722.57
7.0.200.0020.00516.45
7.0.70.4100.04019.95
7.0.60.0070.05719.97
7.0.50.0030.04717.89
7.0.40.0070.08720.14
7.0.30.0230.07720.26
7.0.20.0170.04320.11
7.0.10.0330.07320.10
7.0.00.0130.08320.12
5.6.280.0000.03321.04
5.6.210.0070.06320.61
5.6.200.0130.07318.16
5.6.190.0100.08020.60
5.6.180.0230.03720.42
5.6.170.0100.04720.47
5.6.160.0130.07320.48
5.6.150.0030.04318.16
5.6.140.0070.06718.28
5.6.130.0100.06318.30
5.6.120.0030.09021.12
5.6.110.0130.07721.00
5.6.100.0000.08320.99
5.6.90.0170.08021.14
5.6.80.0030.08020.39
5.6.70.0270.05720.54
5.5.350.0130.07720.52
5.5.340.0030.05318.09
5.5.330.0070.05320.29
5.5.320.0070.08720.43
5.5.310.0170.04720.28
5.5.300.0030.08717.99
5.5.290.0100.07718.05
5.5.280.0100.07020.86
5.5.270.0070.06720.96
5.5.260.0070.08320.91
5.5.250.0030.05720.59
5.5.240.0070.08020.29
5.4.450.0270.07019.49
5.4.440.0300.06019.57
5.4.430.0230.05719.38
5.4.420.0230.05719.19
5.4.410.0270.06019.04
5.4.400.0300.04718.88
5.4.390.0330.04718.89
5.4.380.0300.04319.14
5.4.370.0370.05019.05
5.4.360.0270.05318.87
5.4.350.0230.05719.09
5.4.340.0270.06019.28
5.4.320.0170.06019.13
5.4.310.0230.05019.25
5.4.300.0230.05019.28
5.4.290.0300.04719.01
5.4.280.0300.04719.14
5.4.270.0300.05019.35
5.4.260.0230.05019.13
5.4.250.0330.04319.35
5.4.240.0270.05318.86
5.4.230.0330.05019.35
5.4.220.0270.05319.11
5.4.210.0170.06018.88
5.4.200.0370.04319.14
5.4.190.0200.06019.21
5.4.180.0270.05719.00
5.4.170.0300.05019.28
5.4.160.0230.05319.26
5.4.150.0330.05319.29
5.4.140.0100.06316.61
5.4.130.0270.04716.59
5.4.120.0270.04716.43
5.4.110.0270.04716.66
5.4.100.0230.05316.67
5.4.90.0430.04316.28
5.4.80.0130.05716.22
5.4.70.0000.03716.49
5.4.60.0130.06716.53
5.4.50.0030.05016.42
5.4.40.0100.06316.50
5.4.30.0000.07716.52
5.4.20.0300.04016.54
5.4.10.0300.04716.31

preferences:
62.48 ms | 401 KiB | 5 Q