3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Baz { private $eventq = 'test222'; } class Bar{ private $event = 'test'; private $test3; /** * Constructor. */ public function __construct() { $this->test3 = [ new Baz(), ]; } } class Foo { private $test = 'sd'; private $test2; /** * Constructor. */ public function __construct() { $this->test2 = [ new Bar(), new Bar(), new Bar(), new Bar(), [ new Bar(), new Bar(), ] ]; } public function dismount($object = null) { $object = $object?: $this; $reflectionClass = new \ReflectionClass(get_class($object)); $array =[]; foreach ($reflectionClass->getProperties() as $property) { $property->setAccessible(true); $value = $property->getValue($object); if (is_array($value)) { $this->foo($value, $property, $array); continue; } $array[$property->getName()] = $value; $property->setAccessible(false); } return $array; } private function foo($value, \ReflectionProperty $property, &$array) { foreach ($value as $name => $subValue) { if (is_object($subValue)) { $array[$property->getName()][$name] = $this->dismount($subValue); continue; } if (is_array($subValue)) { $this->foo($subValue, $property, $array); continue; } $array[$property->getName()][$name] = $subValue; } } } $foo = new Foo; var_dump( $foo->dismount());

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.40.0100.00718.85
8.3.30.0120.00318.75
8.3.20.0080.00020.21
8.3.10.0030.00521.85
8.3.00.0040.00420.89
8.2.170.0150.00622.96
8.2.160.0070.01322.14
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00422.34
8.2.120.0070.00726.35
8.2.110.0060.00320.38
8.2.100.0040.00817.84
8.2.90.0040.00419.20
8.2.80.0040.00418.05
8.2.70.0080.00017.63
8.2.60.0000.00917.93
8.2.50.0050.00318.10
8.2.40.0040.00420.64
8.2.30.0030.00620.97
8.2.20.0000.00718.31
8.2.10.0040.00418.30
8.2.00.0040.00418.15
8.1.270.0090.00022.04
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0090.00022.08
8.1.230.0040.00719.14
8.1.220.0030.00717.91
8.1.210.0000.00818.77
8.1.200.0040.00417.35
8.1.190.0050.00317.35
8.1.180.0030.00618.10
8.1.170.0000.00818.66
8.1.160.0050.00218.96
8.1.150.0050.00320.72
8.1.140.0040.00419.61
8.1.130.0000.00718.93
8.1.120.0030.00317.43
8.1.110.0070.00017.52
8.1.100.0040.00417.53
8.1.90.0040.00417.50
8.1.80.0080.00017.43
8.1.70.0000.00717.53
8.1.60.0060.00317.69
8.1.50.0040.00417.46
8.1.40.0040.00417.45
8.1.30.0030.00617.67
8.1.20.0060.00317.60
8.1.10.0050.00317.59
8.1.00.0040.00417.42
8.0.300.0070.00018.77
8.0.290.0030.00616.88
8.0.280.0070.00018.34
8.0.270.0040.00417.30
8.0.260.0030.00316.93
8.0.250.0030.00316.94
8.0.240.0040.00416.92
8.0.230.0040.00416.95
8.0.220.0000.00716.95
8.0.210.0070.00016.98
8.0.200.0000.00617.05
8.0.190.0030.00617.04
8.0.180.0040.00416.92
8.0.170.0000.00717.10
8.0.160.0080.00016.86
8.0.150.0000.00816.98
8.0.140.0040.00416.86
8.0.130.0030.00313.45
8.0.120.0040.00416.93
8.0.110.0040.00416.98
8.0.100.0020.00516.99
8.0.90.0040.00416.90
8.0.80.0150.00916.93
8.0.70.0040.00417.04
8.0.60.0040.00416.96
8.0.50.0040.00417.06
8.0.30.0030.01317.19
8.0.20.0160.01017.41
8.0.10.0040.00417.01
8.0.00.0130.00316.96
7.4.330.0000.00515.55
7.4.320.0040.00416.57
7.4.300.0000.00716.45
7.4.290.0030.00316.55
7.4.280.0030.00616.46
7.4.270.0070.00016.71
7.4.260.0000.00713.31
7.4.250.0000.00816.62
7.4.240.0000.00716.66
7.4.230.0040.00416.45
7.4.220.0130.00616.52
7.4.210.0080.00816.60
7.4.200.0050.00316.54
7.4.160.0100.00816.50
7.4.150.0090.00917.40
7.4.140.0130.00917.86
7.4.130.0070.01316.46
7.4.120.0100.01016.58
7.4.110.0100.01016.57
7.4.100.0100.00716.69
7.4.90.0110.00716.53
7.4.80.0110.01119.39
7.4.70.0070.01516.50
7.4.60.0120.00616.63
7.4.50.0080.00816.40
7.4.40.0140.00316.68
7.4.30.0150.00916.46
7.4.00.0070.01015.13
7.3.330.0060.00013.40
7.3.320.0000.00513.18
7.3.310.0000.00816.21
7.3.300.0000.00716.39
7.3.290.0040.00416.40
7.3.280.0090.00816.38
7.3.270.0070.01117.40
7.3.260.0130.00516.40
7.3.250.0100.01216.56
7.3.240.0080.01316.42
7.3.230.0210.00016.64
7.3.210.0170.00016.54
7.3.200.0100.01016.49
7.3.190.0030.01316.41
7.3.180.0090.00916.35
7.3.170.0170.00016.61
7.3.160.0120.00616.38
7.2.330.0080.01116.85
7.2.320.0100.01316.79
7.2.310.0050.01316.75
7.2.300.0090.00916.67
7.2.290.0030.01316.54
7.2.60.0120.00016.92
7.2.00.0030.01019.26
7.1.200.0030.01015.65
7.1.100.0060.00618.28
7.1.70.0050.00217.27
7.1.60.0330.01333.21
7.1.50.0430.01032.95
7.1.40.0330.01732.70
7.1.30.0230.01732.63
7.1.20.0330.01732.84
7.1.10.0270.01314.87
7.1.00.0200.00714.75
7.0.200.0230.01014.76
7.0.190.0230.01014.79
7.0.180.0530.00714.67
7.0.170.0330.00714.57
7.0.160.0330.00314.74
7.0.150.0400.00714.26
7.0.140.0200.01714.67
7.0.130.0300.00714.82
7.0.120.0270.01014.90
7.0.110.0370.00714.49
7.0.100.0300.01014.62
7.0.90.0200.01714.50
7.0.80.0230.01314.56
7.0.70.0300.00714.46
7.0.60.0200.01714.16
7.0.50.0270.01014.54
7.0.40.0270.01014.64
7.0.30.0300.00714.61
7.0.20.0200.01314.58
7.0.10.0300.01314.87
7.0.00.0270.01014.42

preferences:
37.42 ms | 400 KiB | 5 Q