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 Baz(), new Baz(), ] ]; } 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.0180.00418.55
8.3.50.0040.01116.52
8.3.40.0130.00318.67
8.3.30.0120.00318.67
8.3.20.0000.00720.16
8.3.10.0080.00021.90
8.3.00.0050.00320.94
8.2.180.0160.00318.16
8.2.170.0140.00422.96
8.2.160.0070.00722.17
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0000.00822.26
8.2.120.0000.00826.35
8.2.110.0030.00722.29
8.2.100.0110.00020.50
8.2.90.0060.00320.09
8.2.80.0030.00619.35
8.2.70.0040.00418.00
8.2.60.0000.00818.01
8.2.50.0040.00418.10
8.2.40.0040.00422.37
8.2.30.0030.00520.97
8.2.20.0020.00518.26
8.2.10.0040.00418.17
8.2.00.0080.00018.25
8.1.280.0160.00625.92
8.1.270.0060.00322.06
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00924.05
8.1.230.0120.00419.06
8.1.220.0060.00317.74
8.1.210.0000.00918.77
8.1.200.0040.00617.35
8.1.190.0050.00317.09
8.1.180.0000.01118.10
8.1.170.0050.00318.51
8.1.160.0040.00418.98
8.1.150.0030.00620.67
8.1.140.0030.00519.63
8.1.130.0070.00019.04
8.1.120.0030.00517.48
8.1.110.0040.00417.37
8.1.100.0040.00417.39
8.1.90.0040.00417.39
8.1.80.0000.00717.42
8.1.70.0030.00317.49
8.1.60.0030.00517.64
8.1.50.0050.00317.62
8.1.40.0050.00317.46
8.1.30.0040.00417.66
8.1.20.0000.00917.61
8.1.10.0080.00017.64
8.1.00.0080.00017.47
8.0.300.0040.00419.85
8.0.290.0000.00816.73
8.0.280.0030.00318.50
8.0.270.0000.00717.30
8.0.260.0030.00316.93
8.0.250.0040.00417.09
8.0.240.0040.00416.91
8.0.230.0000.00717.05
8.0.220.0030.00517.00
8.0.210.0000.00717.01
8.0.200.0040.00417.09
8.0.190.0000.00917.09
8.0.180.0000.00816.92
8.0.170.0030.00317.07
8.0.160.0000.00716.96
8.0.150.0040.00417.01
8.0.140.0000.00716.90
8.0.130.0060.00013.48
8.0.120.0030.00616.97
8.0.110.0040.00416.90
8.0.100.0000.00817.05
8.0.90.0050.00217.02
8.0.80.0160.00717.00
8.0.70.0040.00416.98
8.0.60.0040.00417.05
8.0.50.0050.00216.93
8.0.30.0140.00717.12
8.0.20.0120.01117.40
8.0.10.0040.00417.20
8.0.00.0100.01016.99
7.4.330.0030.00315.55
7.4.320.0030.00316.68
7.4.300.0080.00016.68
7.4.290.0030.00316.66
7.4.280.0050.00316.59
7.4.270.0080.00016.54
7.4.260.0030.00313.31
7.4.250.0040.00416.52
7.4.240.0070.00016.60
7.4.230.0030.00316.65
7.4.220.0040.01516.43
7.4.210.0080.01016.66
7.4.200.0040.00416.56
7.4.160.0060.01116.69
7.4.150.0040.02217.40
7.4.140.0120.00917.86
7.4.130.0130.00816.64
7.4.120.0170.00716.62
7.4.110.0150.00416.42
7.4.100.0080.01616.73
7.4.90.0090.00916.50
7.4.80.0100.00719.39
7.4.70.0120.00616.46
7.4.60.0070.01016.56
7.4.50.0090.00316.59
7.4.40.0120.00616.59
7.4.30.0090.01016.44
7.4.10.0070.01015.11
7.4.00.0090.00915.17
7.3.330.0020.00213.39
7.3.320.0030.00313.39
7.3.310.0050.00216.43
7.3.300.0040.00416.36
7.3.290.0000.00716.27
7.3.280.0090.00816.38
7.3.270.0150.00317.40
7.3.260.0080.01116.51
7.3.250.0170.00516.48
7.3.240.0110.00716.59
7.3.230.0120.00616.41
7.3.210.0090.00816.59
7.3.200.0090.01316.36
7.3.190.0090.00916.42
7.3.180.0110.00716.63
7.3.170.0140.00316.56
7.3.160.0090.00916.43
7.3.130.0030.01614.77
7.3.120.0120.00614.94
7.3.110.0130.00715.06
7.3.100.0100.00314.73
7.3.90.0070.01015.09
7.3.80.0000.01015.26
7.3.70.0000.00915.03
7.3.60.0080.00414.65
7.3.50.0030.01014.64
7.3.40.0100.00714.91
7.3.30.0070.00715.09
7.3.20.0000.01216.72
7.3.10.0060.00616.78
7.3.00.0040.00716.52
7.2.330.0120.00616.82
7.2.320.0000.02216.82
7.2.310.0070.01016.79
7.2.300.0090.00916.44
7.2.290.0060.01216.75
7.2.260.0040.01415.18
7.2.250.0110.00715.28
7.2.240.0000.01415.25
7.2.230.0060.01315.10
7.2.220.0060.01015.01
7.2.210.0100.00314.98
7.2.200.0110.00415.06
7.2.190.0080.00415.20
7.2.180.0070.00715.15
7.2.170.0050.00515.12
7.2.160.0070.00414.75
7.2.150.0070.00716.91
7.2.140.0130.00316.89
7.2.130.0000.01616.80
7.2.120.0130.00716.85
7.2.110.0070.00717.05
7.2.100.0030.01416.96
7.2.90.0040.01516.83
7.2.80.0000.01417.02
7.2.70.0000.01517.02
7.2.60.0050.00716.85
7.2.50.0090.00616.75
7.2.40.0070.00717.06
7.2.30.0060.00917.05
7.2.20.0080.00417.04
7.2.10.0040.01517.09
7.2.00.0050.00818.33
7.1.330.0060.01015.72
7.1.320.0040.01115.79
7.1.310.0040.00815.68
7.1.300.0000.01415.75
7.1.290.0000.01415.89
7.1.280.0060.00615.79
7.1.270.0070.00416.00
7.1.260.0060.00615.76
7.1.250.0030.00915.89
7.1.240.0040.01515.64
7.1.230.0040.01115.70
7.1.220.0100.00315.84
7.1.210.0050.00815.88
7.1.200.0030.00915.84
7.1.190.0090.00315.89
7.1.180.0030.00915.77
7.1.170.0030.00915.63
7.1.160.0090.00415.84
7.1.150.0090.00615.46
7.1.140.0080.00815.83
7.1.130.0000.00815.46
7.1.120.0030.01015.61
7.1.110.0000.01415.75
7.1.100.0060.00416.88
7.1.90.0040.01115.63
7.1.80.0070.00715.79
7.1.70.0020.00816.29
7.1.60.0270.01724.29
7.1.50.0230.00824.58
7.1.40.0210.01124.26
7.1.30.0180.01524.26
7.1.20.0330.01224.26
7.1.10.0180.00615.22
7.1.00.0200.00515.26
7.0.330.0000.01015.45
7.0.320.0110.00415.16
7.0.310.0060.00615.55
7.0.300.0030.01215.16
7.0.290.0080.00415.52
7.0.280.0030.00815.39
7.0.270.0000.01215.18
7.0.260.0120.00315.47
7.0.250.0060.00315.37
7.0.240.0030.00515.36
7.0.230.0050.00515.55
7.0.220.0000.01415.27
7.0.210.0030.00715.51
7.0.200.0170.00915.30
7.0.190.0220.00515.15
7.0.180.0170.01114.82
7.0.170.0180.00815.03
7.0.160.0210.00814.89
7.0.150.0170.00815.10
7.0.140.0170.00714.90
7.0.130.0150.01015.09
7.0.120.0170.00915.18
7.0.110.0150.00915.09
7.0.100.0130.01015.04
7.0.90.0160.00515.09
7.0.80.0160.01115.15
7.0.70.0200.00815.03
7.0.60.0170.00714.85
7.0.50.0170.00715.01
7.0.40.0170.01114.09
7.0.30.0200.00814.21
7.0.20.0120.01114.13
7.0.10.0620.00914.22
7.0.00.0130.01013.91
5.6.400.0000.01214.70
5.6.390.0090.00614.21
5.6.380.0040.01214.41
5.6.370.0040.01414.79
5.6.360.0040.00814.71
5.6.350.0130.00314.62
5.6.340.0000.01414.50
5.6.330.0030.01014.71
5.6.320.0030.00914.40
5.6.310.0000.01414.75
5.6.300.0000.01014.41
5.6.290.0040.01214.44
5.6.280.0070.01114.52
5.6.270.0070.00714.45
5.6.260.0090.00314.34
5.6.250.0030.01014.45
5.6.240.0040.01414.55
5.6.230.0110.00414.34
5.6.220.0040.00814.51
5.6.210.0070.00314.48
5.6.200.0060.00614.50
5.6.190.0100.00314.64
5.6.180.0060.00914.16
5.6.170.0100.00714.51
5.6.160.0030.01014.63
5.6.150.0030.01014.61
5.6.140.0040.01214.41
5.6.130.0000.01314.79
5.6.120.0070.00714.27
5.6.110.0100.00614.23
5.6.100.0100.00614.40
5.6.90.0030.00914.36
5.6.80.0100.00314.15
5.6.70.0040.01114.52
5.6.60.0070.00314.25
5.6.50.0080.00414.55
5.6.40.0040.00814.46
5.6.30.0090.00614.52
5.6.20.0100.00314.44
5.6.10.0090.00614.35
5.6.00.0030.00914.39

preferences:
43.07 ms | 401 KiB | 5 Q