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(), 'asda' ]; } 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.70.0180.00318.29
8.3.60.0110.00718.20
8.3.50.0120.00716.57
8.3.40.0070.01018.84
8.3.30.0090.00618.79
8.3.20.0070.00020.34
8.3.10.0080.00021.82
8.3.00.0050.00320.77
8.2.180.0140.00418.41
8.2.170.0110.00422.96
8.2.160.0070.00722.00
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00022.25
8.2.120.0070.00726.35
8.2.110.0030.00720.47
8.2.100.0060.00617.84
8.2.90.0000.00819.40
8.2.80.0040.00417.97
8.2.70.0030.00517.63
8.2.60.0090.00017.93
8.2.50.0000.00818.10
8.2.40.0070.00020.64
8.2.30.0000.00821.02
8.2.20.0000.00718.23
8.2.10.0040.00418.13
8.2.00.0030.00518.33
8.1.280.0160.00625.92
8.1.270.0060.00322.05
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00620.85
8.1.230.0040.00818.97
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0030.00717.47
8.1.190.0080.00017.22
8.1.180.0040.00418.10
8.1.170.0050.00318.65
8.1.160.0000.00719.07
8.1.150.0050.00320.66
8.1.140.0050.00319.54
8.1.130.0040.00418.93
8.1.120.0000.00717.51
8.1.110.0000.00717.46
8.1.100.0000.00817.51
8.1.90.0050.00317.48
8.1.80.0040.00417.54
8.1.70.0070.00017.40
8.1.60.0030.00617.52
8.1.50.0060.00317.57
8.1.40.0000.00817.47
8.1.30.0030.00517.64
8.1.20.0080.00017.72
8.1.10.0080.00017.54
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0030.00616.88
8.0.280.0030.00318.41
8.0.270.0000.00817.22
8.0.260.0070.00016.87
8.0.250.0040.00416.99
8.0.240.0050.00316.88
8.0.230.0000.00717.05
8.0.220.0000.00716.94
8.0.210.0000.00717.09
8.0.200.0070.00017.08
8.0.190.0050.00416.98
8.0.180.0000.00816.94
8.0.170.0040.00417.03
8.0.160.0000.00817.03
8.0.150.0060.00316.91
8.0.140.0030.00516.98
8.0.130.0030.00313.41
8.0.120.0000.00716.98
8.0.110.0080.00016.99
8.0.100.0080.00016.88
8.0.90.0030.00516.90
8.0.80.0160.00317.00
8.0.70.0080.00016.80
8.0.60.0040.00416.90
8.0.50.0000.00816.91
8.0.30.0110.00617.30
8.0.20.0130.00717.40
8.0.10.0080.00017.01
8.0.00.0160.00616.66
7.4.330.0000.00515.55
7.4.320.0000.00816.57
7.4.300.0040.00416.66
7.4.290.0000.00716.57
7.4.280.0000.00816.63
7.4.270.0070.00016.64
7.4.260.0040.00413.29
7.4.250.0030.00516.61
7.4.240.0040.00416.58
7.4.230.0000.00716.39
7.4.220.0130.00716.37
7.4.210.0090.01016.75
7.4.200.0000.00716.41
7.4.160.0100.00816.53
7.4.150.0160.00317.40
7.4.140.0140.00817.86
7.4.130.0120.01016.46
7.4.120.0090.01216.61
7.4.110.0040.01316.56
7.4.100.0150.00816.64
7.4.90.0090.00916.63
7.4.80.0100.00719.39
7.4.70.0110.00716.47
7.4.60.0060.01216.39
7.4.50.0090.00316.47
7.4.40.0130.00616.44
7.4.30.0170.00616.35
7.4.00.0110.00815.07
7.3.330.0000.00513.24
7.3.320.0030.00313.31
7.3.310.0000.00716.30
7.3.300.0000.00716.40
7.3.290.0070.00016.40
7.3.280.0110.00716.40
7.3.270.0120.00617.40
7.3.260.0120.00616.56
7.3.250.0120.01016.44
7.3.240.0110.00716.45
7.3.230.0140.00316.69
7.3.210.0120.00616.63
7.3.200.0070.01016.36
7.3.190.0040.01216.63
7.3.180.0100.00716.66
7.3.170.0110.00616.46
7.3.160.0090.01016.48
7.3.120.0090.00914.94
7.3.110.0110.00714.90
7.3.100.0030.01114.90
7.3.90.0050.00714.80
7.3.80.0050.00814.91
7.3.70.0030.01214.85
7.3.60.0030.01014.71
7.3.50.0050.00814.83
7.3.40.0050.00814.87
7.3.30.0040.01414.65
7.3.20.0070.00716.64
7.3.10.0110.00416.75
7.3.00.0040.01116.59
7.2.330.0110.00716.42
7.2.320.0090.01516.59
7.2.310.0140.00316.64
7.2.300.0090.00916.45
7.2.290.0160.00316.80
7.2.250.0050.01315.23
7.2.240.0070.01415.04
7.2.230.0030.01015.05
7.2.220.0070.00315.28
7.2.210.0070.00815.11
7.2.200.0020.01514.98
7.2.190.0030.00715.06
7.2.180.0090.00515.18
7.2.170.0030.01515.15
7.2.60.0070.00716.76
7.2.00.0080.00419.51
7.1.330.0060.00915.55
7.1.320.0070.00515.77
7.1.310.0080.00615.81
7.1.300.0060.00615.83
7.1.290.0070.00915.80
7.1.280.0040.01115.73
7.1.270.0060.00915.77
7.1.260.0080.00615.81
7.1.200.0040.00815.93
7.1.100.0040.00818.33
7.1.70.0000.00816.96
7.1.60.0370.00733.04
7.1.50.0530.01732.86
7.1.40.0400.00732.82
7.1.30.0370.00732.88
7.1.20.0330.01032.79
7.1.10.0400.01014.73
7.1.00.0370.00714.89
7.0.200.0170.01714.92
7.0.190.0230.01015.13
7.0.180.0130.01714.54
7.0.170.0270.00314.54
7.0.160.0200.01314.48
7.0.150.0170.01014.38
7.0.140.0270.00314.50
7.0.130.0230.00714.77
7.0.120.0930.01014.75
7.0.110.0170.01014.70
7.0.100.0200.01014.63
7.0.90.0270.00314.58
7.0.80.0200.01014.66
7.0.70.0270.00314.46
7.0.60.0170.01014.38
7.0.50.0170.01014.52
7.0.40.0200.00714.83
7.0.30.0230.01014.64
7.0.20.0200.00714.71
7.0.10.0170.01314.54
7.0.00.0230.01014.48

preferences:
50.11 ms | 401 KiB | 5 Q