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(), [ 'asdasd' ] ]; } 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.60.0150.00618.55
8.3.50.0170.00316.49
8.3.40.0060.01018.66
8.3.30.0000.01518.70
8.3.20.0080.00020.20
8.3.10.0030.00521.79
8.3.00.0080.00020.81
8.2.180.0150.00318.16
8.2.170.0150.00022.96
8.2.160.0070.00722.05
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00422.08
8.2.120.0030.00626.35
8.2.110.0030.00720.39
8.2.100.0080.00417.82
8.2.90.0080.00019.17
8.2.80.0000.00818.05
8.2.70.0040.00417.50
8.2.60.0060.00318.03
8.2.50.0080.00018.10
8.2.40.0090.00020.47
8.2.30.0000.00921.00
8.2.20.0080.00018.24
8.2.10.0040.00418.24
8.2.00.0000.00718.05
8.1.280.0110.00725.92
8.1.270.0040.00422.21
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00320.90
8.1.230.0080.00319.08
8.1.220.0030.00617.79
8.1.210.0000.00818.77
8.1.200.0070.00317.60
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0040.00418.78
8.1.160.0000.00819.13
8.1.150.0000.00920.68
8.1.140.0000.00719.64
8.1.130.0040.00418.98
8.1.120.0080.00017.53
8.1.110.0030.00617.53
8.1.100.0000.00817.48
8.1.90.0050.00317.38
8.1.80.0000.00717.54
8.1.70.0000.00717.38
8.1.60.0040.00417.64
8.1.50.0040.00417.47
8.1.40.0040.00417.52
8.1.30.0040.00417.72
8.1.20.0000.00817.55
8.1.10.0000.00817.54
8.1.00.0040.00417.57
8.0.300.0030.00718.77
8.0.290.0080.00016.75
8.0.280.0030.00318.41
8.0.270.0000.00717.32
8.0.260.0000.00716.93
8.0.250.0070.00017.11
8.0.240.0040.00416.96
8.0.230.0040.00417.10
8.0.220.0070.00016.89
8.0.210.0000.00716.98
8.0.200.0060.00017.04
8.0.190.0000.00816.97
8.0.180.0040.00417.09
8.0.170.0050.00217.05
8.0.160.0000.00716.97
8.0.150.0050.00316.84
8.0.140.0000.00716.97
8.0.130.0000.00613.45
8.0.120.0090.00016.93
8.0.110.0000.00716.91
8.0.100.0030.00516.85
8.0.90.0000.00716.87
8.0.80.0090.00916.91
8.0.70.0030.00516.89
8.0.60.0000.00816.89
8.0.50.0000.00816.88
8.0.30.0110.00917.29
8.0.20.0150.01617.40
8.0.10.0040.00417.20
8.0.00.0160.00617.13
7.4.330.0020.00215.55
7.4.320.0030.00316.66
7.4.300.0000.00816.62
7.4.290.0030.00316.65
7.4.280.0050.00216.62
7.4.270.0000.00716.67
7.4.260.0070.00013.38
7.4.250.0030.00316.55
7.4.240.0000.00716.66
7.4.230.0020.00516.57
7.4.220.0120.00616.45
7.4.210.0000.01416.61
7.4.200.0000.00716.36
7.4.160.0060.01116.54
7.4.150.0090.01217.40
7.4.140.0130.01017.86
7.4.130.0000.02216.39
7.4.120.0100.01016.54
7.4.110.0080.01216.52
7.4.100.0120.00616.52
7.4.90.0130.00916.45
7.4.80.0060.01319.39
7.4.70.0150.00316.64
7.4.60.0090.00816.61
7.4.50.0060.00916.47
7.4.40.0060.01116.60
7.4.30.0090.00916.58
7.4.00.0090.00615.12
7.3.330.0050.00013.42
7.3.320.0050.00013.27
7.3.310.0030.00316.43
7.3.300.0030.00316.46
7.3.290.0070.00816.40
7.3.280.0100.00816.39
7.3.270.0030.01517.40
7.3.260.0080.01016.43
7.3.250.0130.00816.52
7.3.240.0100.01116.50
7.3.230.0170.00016.44
7.3.210.0180.00016.53
7.3.200.0140.00316.70
7.3.190.0080.01116.70
7.3.180.0090.00916.58
7.3.170.0040.01516.66
7.3.160.0120.00816.56
7.2.330.0080.00816.75
7.2.320.0120.01216.57
7.2.310.0060.01916.57
7.2.300.0110.00616.84
7.2.290.0030.01516.62
7.2.00.0030.00919.47
7.1.100.0060.00618.18
7.1.70.0040.00417.09
7.1.60.0470.01033.36
7.1.50.0530.00733.05
7.1.40.0570.00732.79
7.1.30.0630.00732.94
7.1.20.0470.01332.83
7.1.10.0330.00714.75
7.1.00.0370.00714.80
7.0.200.0530.00315.07
7.0.190.0330.00714.93
7.0.180.0430.01014.53
7.0.170.0370.01014.41
7.0.160.0030.01014.29
7.0.150.0200.01014.55
7.0.140.0100.01014.63
7.0.130.0330.01314.93
7.0.120.0330.01014.53
7.0.110.0000.01314.46
7.0.100.0300.01014.55
7.0.90.0400.01314.57
7.0.80.0430.00714.53
7.0.70.0200.01714.43
7.0.60.0030.01014.31
7.0.50.0070.00714.51
7.0.40.0430.01314.61
7.0.30.0400.01014.92
7.0.20.0430.01714.70
7.0.10.0370.01014.60
7.0.00.0600.00014.78

preferences:
39.69 ms | 400 KiB | 5 Q