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(), new Baz(), new Baz(), new Baz(), ]; } } class Foo { private $test = 'sd'; private $test2; /** * Constructor. */ public function __construct() { $this->test2 = [ 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; } } } } $foo = new Foo; print_r( $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.60.0070.01518.56
8.3.50.0100.01016.39
8.3.40.0120.00318.66
8.3.30.0120.00618.84
8.3.20.0040.00420.35
8.3.10.0080.00021.77
8.3.00.0050.00320.82
8.2.180.0070.00718.51
8.2.170.0130.00322.96
8.2.160.0140.00022.25
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0000.00822.25
8.2.120.0040.00426.35
8.2.110.0090.00020.47
8.2.100.0090.00318.03
8.2.90.0000.00819.14
8.2.80.0040.00418.16
8.2.70.0040.00417.63
8.2.60.0090.00017.93
8.2.50.0000.00818.10
8.2.40.0040.00422.32
8.2.30.0030.00521.14
8.2.20.0050.00218.22
8.2.10.0050.00218.19
8.2.00.0040.00418.27
8.1.280.0100.00725.92
8.1.270.0000.00722.05
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00320.95
8.1.230.0000.01119.01
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0000.00818.69
8.1.160.0000.00818.97
8.1.150.0040.00420.68
8.1.140.0040.00419.68
8.1.130.0030.00318.91
8.1.120.0040.00417.50
8.1.110.0040.00417.55
8.1.100.0040.00417.37
8.1.90.0040.00417.52
8.1.80.0040.00417.41
8.1.70.0000.00717.40
8.1.60.0040.00417.69
8.1.50.0040.00417.46
8.1.40.0000.00917.57
8.1.30.0080.00017.60
8.1.20.0030.00617.71
8.1.10.0040.00417.69
8.1.00.0040.00417.48
8.0.300.0070.00018.77
8.0.290.0000.00717.00
8.0.280.0030.00318.47
8.0.270.0050.00317.36
8.0.260.0030.00316.79
8.0.250.0000.00717.03
8.0.240.0000.00816.93
8.0.230.0090.00016.99
8.0.220.0000.00717.02
8.0.210.0000.00716.89
8.0.200.0000.00817.05
8.0.190.0050.00317.10
8.0.180.0000.00717.07
8.0.170.0000.00717.05
8.0.160.0040.00416.98
8.0.150.0050.00317.07
8.0.140.0040.00416.88
8.0.130.0000.00513.44
8.0.120.0000.00816.99
8.0.110.0040.00416.89
8.0.100.0040.00416.91
8.0.90.0000.00817.01
8.0.80.0070.00716.93
8.0.70.0040.00416.99
8.0.60.0000.00816.87
8.0.50.0000.00717.07
8.0.30.0140.00517.17
8.0.20.0110.01417.40
8.0.10.0030.00317.09
8.0.00.0140.00316.76
7.4.330.0050.00015.55
7.4.320.0000.00616.58
7.4.300.0060.00016.55
7.4.290.0030.00316.64
7.4.280.0040.00416.57
7.4.270.0000.00716.64
7.4.260.0000.00613.27
7.4.250.0000.00716.64
7.4.240.0000.00816.57
7.4.230.0070.00016.43
7.4.220.0130.00616.32
7.4.210.0100.01016.54
7.4.200.0000.00716.65
7.4.160.0080.00916.60
7.4.150.0100.00717.40
7.4.140.0110.00817.86
7.4.130.0110.00816.52
7.4.120.0120.00916.59
7.4.110.0140.00316.50
7.4.100.0040.01516.51
7.4.90.0100.00716.54
7.4.80.0160.00619.39
7.4.70.0170.00016.58
7.4.60.0030.01716.60
7.4.50.0040.01416.52
7.4.40.0110.00516.51
7.4.30.0090.01216.59
7.4.00.0040.01114.80
7.3.330.0050.00013.26
7.3.320.0000.00513.43
7.3.310.0000.00716.44
7.3.300.0030.00316.41
7.3.290.0030.00316.40
7.3.280.0070.00916.39
7.3.270.0100.00817.40
7.3.260.0200.01416.50
7.3.250.0080.01316.58
7.3.240.0120.01116.51
7.3.230.0120.00916.45
7.3.210.0030.01316.56
7.3.200.0090.01516.54
7.3.190.0130.00316.47
7.3.180.0120.00316.57
7.3.170.0100.01016.59
7.3.160.0030.01416.57
7.2.330.0090.00916.89
7.2.320.0090.01316.81
7.2.310.0060.00916.63
7.2.300.0120.00416.54
7.2.290.0050.01216.68
7.2.60.0110.00417.03
7.1.200.0030.00915.94
7.1.100.0030.00717.88
7.1.70.0050.00317.30
7.1.60.0470.01333.13
7.1.50.0330.01333.04
7.1.40.0330.01032.55
7.1.30.0270.01332.61
7.1.20.0330.01732.79
7.1.10.0770.00314.70
7.1.00.0270.00014.89
7.0.200.0200.02014.98
7.0.190.0230.00715.14
7.0.180.0300.00714.72
7.0.170.0270.01014.46
7.0.160.0430.01014.57
7.0.150.0230.01714.50
7.0.140.0230.01314.47
7.0.130.0230.01014.84
7.0.120.0270.01314.69
7.0.110.0270.01014.63
7.0.100.0230.00314.44
7.0.90.0170.01314.46
7.0.80.0230.01314.52
7.0.70.0300.01314.45
7.0.60.0230.01014.39
7.0.50.0170.01014.64
7.0.40.0230.00714.93
7.0.30.0200.01014.48
7.0.20.0200.01014.69
7.0.10.0270.00714.87
7.0.00.0170.01014.70

preferences:
38.15 ms | 400 KiB | 5 Q