3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Baz { private $BazEvent = 'BazEvent'; } class Bar{ private $event = 'BarEvent'; private $secendClass; /** * Constructor. */ public function __construct() { $this->secendClass = [ new Baz(), ]; } } class Foo { private $test = 'sd'; private $firstClass; /** * Constructor. */ public function __construct() { $this->firstClass = [ 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)) { throw new \RuntimeException('Multi-array is currently not supported.'); 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.0160.00318.30
8.3.50.0090.00616.36
8.3.40.0150.00018.70
8.3.30.0100.00718.76
8.3.20.0080.00020.16
8.3.10.0080.00021.73
8.3.00.0050.00320.96
8.2.180.0120.00318.29
8.2.170.0070.00722.96
8.2.160.0100.00322.18
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00422.13
8.2.120.0070.00026.35
8.2.110.0100.00021.11
8.2.100.0090.00320.38
8.2.90.0040.00419.70
8.2.80.0080.00017.98
8.2.70.0000.00818.16
8.2.60.0090.00018.16
8.2.50.0000.00818.10
8.2.40.0040.00422.28
8.2.30.0040.00421.08
8.2.20.0060.00318.12
8.2.10.0030.00518.16
8.2.00.0040.00418.04
8.1.280.0150.00725.92
8.1.270.0030.00522.18
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00322.14
8.1.230.0040.00820.79
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0030.00717.36
8.1.190.0000.00817.23
8.1.180.0070.00218.10
8.1.170.0030.00518.50
8.1.160.0040.00419.05
8.1.150.0060.00320.52
8.1.140.0050.00319.59
8.1.130.0030.00318.97
8.1.120.0040.00417.46
8.1.110.0060.00317.49
8.1.100.0040.00417.54
8.1.90.0080.00017.48
8.1.80.0040.00417.43
8.1.70.0030.00317.46
8.1.60.0000.00917.66
8.1.50.0000.00717.55
8.1.40.0070.00017.41
8.1.30.0080.00017.74
8.1.20.0080.00017.64
8.1.10.0030.00517.63
8.1.00.0040.00417.46
8.0.300.0040.00419.71
8.0.290.0000.00816.88
8.0.280.0070.00018.54
8.0.270.0030.00317.17
8.0.260.0030.00316.92
8.0.250.0030.00317.06
8.0.240.0000.00916.90
8.0.230.0040.00417.11
8.0.220.0030.00316.87
8.0.210.0040.00416.99
8.0.200.0000.00617.07
8.0.190.0030.00617.07
8.0.180.0070.00016.99
8.0.170.0040.00416.91
8.0.160.0040.00416.99
8.0.150.0030.00616.96
8.0.140.0070.00016.98
8.0.130.0070.00013.46
8.0.120.0040.00416.85
8.0.110.0080.00016.97
8.0.100.0050.00217.00
8.0.90.0000.00717.02
8.0.80.0080.00816.93
8.0.70.0000.00717.02
8.0.60.0080.00016.77
8.0.50.0000.00817.04
8.0.30.0110.00517.10
8.0.20.0090.01217.40
8.0.10.0000.00816.99
8.0.00.0080.01116.76
7.4.330.0000.00515.55
7.4.320.0030.00316.63
7.4.300.0030.00316.50
7.4.290.0000.00816.61
7.4.280.0040.00416.54
7.4.270.0040.00416.47
7.4.260.0050.00213.32
7.4.250.0030.00316.50
7.4.240.0000.00716.50
7.4.230.0080.00016.75
7.4.220.0090.00916.41
7.4.210.0140.00016.66
7.4.200.0030.00316.57
7.4.160.0090.00816.70
7.4.150.0090.00917.40
7.4.140.0100.01317.86
7.4.130.0100.01316.57
7.4.120.0130.01116.63
7.4.110.0070.01016.63
7.4.100.0110.00916.66
7.4.90.0030.01616.59
7.4.80.0070.01019.39
7.4.70.0160.00616.70
7.4.60.0110.01816.63
7.4.50.0100.00716.70
7.4.40.0130.00316.54
7.4.30.0090.00916.58
7.4.10.0100.01014.94
7.4.00.0070.00715.07
7.3.330.0050.00013.32
7.3.320.0000.00513.41
7.3.310.0000.00716.39
7.3.300.0000.00716.35
7.3.290.0090.00616.40
7.3.280.0090.00916.39
7.3.270.0090.00817.40
7.3.260.0060.01116.66
7.3.250.0110.00916.35
7.3.240.0090.00916.62
7.3.230.0160.00816.52
7.3.210.0100.00716.52
7.3.200.0140.00316.64
7.3.190.0090.00916.40
7.3.180.0060.01516.59
7.3.170.0030.01516.47
7.3.160.0090.01116.40
7.3.130.0110.00714.71
7.3.120.0030.01314.83
7.3.110.0070.01314.63
7.3.100.0040.01114.91
7.3.90.0100.00314.62
7.3.80.0060.01014.83
7.3.70.0040.00414.55
7.3.60.0030.00914.51
7.3.50.0040.00414.84
7.3.40.0090.00614.88
7.3.30.0080.00814.50
7.3.20.0000.01316.36
7.3.10.0110.00416.62
7.3.00.0090.00316.71
7.2.330.0110.00816.83
7.2.320.0070.01116.59
7.2.310.0070.01116.76
7.2.300.0090.01416.78
7.2.290.0140.00616.79
7.2.260.0090.01115.23
7.2.250.0160.00315.22
7.2.240.0100.00315.23
7.2.230.0090.00914.94
7.2.220.0100.00714.69
7.2.210.0060.00315.15
7.2.200.0100.00015.03
7.2.190.0100.00315.16
7.2.180.0120.00415.05
7.2.170.0030.00615.21
7.2.160.0070.00715.11
7.2.150.0100.00617.02
7.2.140.0090.00616.71
7.2.130.0060.00617.09
7.2.120.0100.00716.71
7.2.110.0090.00617.02
7.2.100.0040.01217.03
7.2.90.0070.00316.90
7.2.80.0150.00016.89
7.2.70.0040.00816.93
7.2.60.0090.00516.94
7.2.50.0030.00616.99
7.2.40.0140.00417.07
7.2.30.0030.00716.82
7.2.20.0130.00316.68
7.2.10.0040.01116.61
7.2.00.0020.01218.26
7.1.330.0040.00715.66
7.1.320.0100.01015.56
7.1.310.0070.00715.71
7.1.300.0100.00315.53
7.1.290.0070.00415.80
7.1.280.0060.00915.70
7.1.270.0070.00415.56
7.1.260.0100.00315.79
7.1.250.0030.01015.73
7.1.240.0070.00715.92
7.1.230.0090.00015.92
7.1.220.0040.00815.84
7.1.210.0070.00715.88
7.1.200.0060.00615.96
7.1.190.0080.00415.53
7.1.180.0040.00715.74
7.1.170.0040.00415.74
7.1.160.0030.00615.62
7.1.150.0080.00415.78
7.1.140.0030.01515.72
7.1.130.0050.00515.84
7.1.120.0030.00715.63
7.1.110.0030.00815.87
7.1.100.0060.00817.06
7.1.90.0040.01115.80
7.1.80.0100.00015.80
7.1.70.0050.01016.56
7.1.60.0120.01524.60
7.1.50.0330.01224.40
7.1.40.0280.00824.32
7.1.30.0290.01024.21
7.1.20.0360.00524.08
7.1.10.0200.00615.34
7.1.00.0200.00715.36
7.0.330.0050.00615.45
7.0.320.0000.01215.21
7.0.310.0120.00315.41
7.0.300.0070.00715.39
7.0.290.0040.00415.39
7.0.280.0070.00715.38
7.0.270.0070.00715.13
7.0.260.0050.00515.51
7.0.250.0110.00415.47
7.0.240.0100.00715.41
7.0.230.0030.01315.38
7.0.220.0050.00515.06
7.0.210.0030.01315.42
7.0.200.0150.01015.17
7.0.190.0170.01015.06
7.0.180.0180.00714.88
7.0.170.0160.01014.96
7.0.160.0150.00914.94
7.0.150.0170.00714.84
7.0.140.0190.00815.10
7.0.130.0140.00715.12
7.0.120.0130.00915.03
7.0.110.0140.00915.06
7.0.100.0150.00714.87
7.0.90.0130.01114.92
7.0.80.0130.01215.09
7.0.70.0150.00814.88
7.0.60.0200.00514.69
7.0.50.0200.00815.13
7.0.40.0180.00914.02
7.0.30.0490.00913.91
7.0.20.0180.00514.10
7.0.10.0150.00514.02
7.0.00.0140.00713.98
5.6.400.0120.00314.55
5.6.390.0040.00714.43
5.6.380.0040.01114.77
5.6.370.0070.00714.60
5.6.360.0090.00314.57
5.6.350.0040.01314.43
5.6.340.0120.00314.62
5.6.330.0060.00914.64
5.6.320.0080.00314.70
5.6.310.0080.00814.61
5.6.300.0040.01114.29
5.6.290.0110.00414.57
5.6.280.0160.00014.19
5.6.270.0000.01414.40
5.6.260.0110.00014.55
5.6.250.0030.00714.37
5.6.240.0040.01414.53
5.6.230.0100.00014.22
5.6.220.0060.00614.53
5.6.210.0060.00914.45
5.6.200.0060.00314.30
5.6.190.0040.01414.46
5.6.180.0070.00714.79
5.6.170.0090.00614.04
5.6.160.0000.01414.63
5.6.150.0100.00314.77
5.6.140.0060.00614.54
5.6.130.0080.00414.42
5.6.120.0080.00414.53
5.6.110.0030.01014.40
5.6.100.0070.00714.29
5.6.90.0060.00614.75
5.6.80.0070.01014.40
5.6.70.0040.01114.16
5.6.60.0030.00614.57
5.6.50.0060.00614.27
5.6.40.0140.00014.39
5.6.30.0080.00414.41
5.6.20.0110.00014.45
5.6.10.0000.01714.27
5.6.00.0030.01014.30

preferences:
39.52 ms | 400 KiB | 5 Q