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(), ]; } 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.0190.00318.30
8.3.50.0120.00316.61
8.3.40.0060.00918.81
8.3.30.0060.00918.45
8.3.20.0080.00020.29
8.3.10.0040.00421.87
8.3.00.0080.00020.96
8.2.180.0090.00618.30
8.2.170.0090.00622.96
8.2.160.0140.00022.17
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00322.29
8.2.120.0040.00426.35
8.2.110.0130.01022.25
8.2.100.0040.00817.84
8.2.90.0060.00319.05
8.2.80.0100.00317.97
8.2.70.0030.00517.63
8.2.60.0030.00617.93
8.2.50.0030.00518.10
8.2.40.0030.00620.60
8.2.30.0080.00021.19
8.2.20.0050.00318.23
8.2.10.0040.00418.19
8.2.00.0040.00418.22
8.1.280.0210.00025.92
8.1.270.0040.00422.14
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0000.00922.80
8.1.230.0090.00317.89
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0100.00017.48
8.1.190.0030.00617.35
8.1.180.0000.00818.10
8.1.170.0040.00418.61
8.1.160.0050.00219.05
8.1.150.0030.00620.55
8.1.140.0040.00419.68
8.1.130.0030.00318.88
8.1.120.0040.00417.55
8.1.110.0060.00317.49
8.1.100.0040.00417.51
8.1.90.0080.00017.51
8.1.80.0040.00417.45
8.1.70.0030.00517.45
8.1.60.0040.00417.64
8.1.50.0040.00417.59
8.1.40.0040.00417.59
8.1.30.0040.00417.74
8.1.20.0060.00317.56
8.1.10.0030.00517.47
8.1.00.0040.00417.55
8.0.300.0030.00618.77
8.0.290.0050.00317.00
8.0.280.0040.00418.49
8.0.270.0080.00017.17
8.0.260.0000.00716.92
8.0.250.0050.00217.04
8.0.240.0050.00316.89
8.0.230.0000.00816.97
8.0.220.0000.00717.01
8.0.210.0040.00417.00
8.0.200.0030.00317.08
8.0.190.0080.00017.09
8.0.180.0040.00417.05
8.0.170.0000.00816.91
8.0.160.0000.00917.12
8.0.150.0040.00416.98
8.0.140.0000.00816.93
8.0.130.0050.00013.48
8.0.120.0000.00816.94
8.0.110.0040.00416.99
8.0.100.0080.00016.94
8.0.90.0040.00416.87
8.0.80.0060.00917.04
8.0.70.0000.00716.87
8.0.60.0030.00516.92
8.0.50.0040.00417.01
8.0.30.0070.01217.16
8.0.20.0130.00717.42
8.0.10.0040.00416.99
8.0.00.0070.01116.60
7.4.330.0000.00515.55
7.4.320.0000.00616.64
7.4.300.0030.00516.68
7.4.290.0040.00416.53
7.4.280.0000.00816.65
7.4.270.0030.00316.53
7.4.260.0030.00313.43
7.4.250.0040.00416.55
7.4.240.0040.00416.65
7.4.230.0030.00316.45
7.4.220.0100.01016.54
7.4.210.0030.01716.71
7.4.200.0030.00316.62
7.4.160.0120.00716.66
7.4.150.0180.00017.40
7.4.140.0100.01117.86
7.4.130.0130.01016.35
7.4.120.0140.01016.52
7.4.110.0100.00616.50
7.4.100.0180.00916.60
7.4.90.0060.01316.55
7.4.80.0030.01619.39
7.4.70.0100.01316.63
7.4.60.0100.00616.60
7.4.50.0070.01116.64
7.4.40.0080.00816.53
7.4.30.0120.00616.58
7.4.10.0160.00315.07
7.4.00.0080.00814.73
7.3.330.0030.00313.22
7.3.320.0050.00013.21
7.3.310.0030.00416.38
7.3.300.0000.00716.30
7.3.290.0080.00716.39
7.3.280.0070.01016.37
7.3.270.0070.01017.40
7.3.260.0100.00716.39
7.3.250.0110.01216.37
7.3.240.0150.00416.39
7.3.230.0100.01016.46
7.3.210.0060.01216.55
7.3.200.0100.00716.58
7.3.190.0130.00616.57
7.3.180.0120.00916.38
7.3.170.0110.00716.51
7.3.160.0030.01916.43
7.3.130.0050.01414.86
7.3.120.0080.01014.81
7.3.110.0070.01115.04
7.3.100.0110.00514.83
7.3.90.0090.00514.90
7.3.80.0040.01014.72
7.3.70.0030.00814.66
7.3.60.0060.00814.89
7.3.50.0070.00614.71
7.3.40.0040.01114.78
7.3.30.0080.00714.87
7.3.20.0110.00516.69
7.3.10.0050.01116.64
7.3.00.0070.00916.70
7.2.330.0030.01716.71
7.2.320.0140.00316.82
7.2.310.0090.00916.85
7.2.300.0120.00616.57
7.2.290.0130.00316.42
7.2.260.0040.00715.05
7.2.250.0070.01115.29
7.2.240.0060.01215.05
7.2.230.0090.00615.04
7.2.220.0070.01015.15
7.2.210.0070.00614.99
7.2.200.0060.00814.87
7.2.190.0050.00915.01
7.2.180.0040.01315.08
7.2.170.0060.01015.01
7.2.160.0030.01215.15
7.2.150.0070.00817.04
7.2.140.0050.01116.89
7.2.130.0040.01416.90
7.2.120.0080.00816.82
7.2.110.0060.00816.79
7.2.100.0090.00716.85
7.2.90.0100.00916.92
7.2.80.0160.00616.93
7.2.70.0070.00816.91
7.2.60.0080.00616.93
7.2.50.0040.00816.85
7.2.40.0060.00816.89
7.2.30.0090.00616.86
7.2.20.0060.01016.79
7.2.10.0080.00716.87
7.2.00.0050.00817.25
7.1.330.0040.01215.73
7.1.320.0100.00515.66
7.1.310.0040.00815.61
7.1.300.0080.00515.79
7.1.290.0070.01015.80
7.1.280.0020.01315.83
7.1.270.0100.00515.67
7.1.260.0030.01315.74
7.1.250.0070.00815.78
7.1.240.0060.00915.86
7.1.230.0040.01015.72
7.1.220.0070.00715.87
7.1.210.0050.00915.68
7.1.200.0070.00815.85
7.1.190.0070.00715.77
7.1.180.0060.00715.70
7.1.170.0070.00715.88
7.1.160.0050.00915.70
7.1.150.0090.00415.81
7.1.140.0070.00715.75
7.1.130.0080.00515.87
7.1.120.0060.00515.77
7.1.110.0080.00415.88
7.1.100.0050.00716.35
7.1.90.0070.00515.84
7.1.80.0050.01015.84
7.1.70.0050.00716.09
7.1.60.0100.00719.67
7.1.50.0070.01019.64
7.1.40.0050.01119.53
7.1.30.0070.00919.57
7.1.20.0100.00719.58
7.1.10.0060.00715.90
7.1.00.0060.00615.94
7.0.330.0060.00715.41
7.0.320.0030.01015.34
7.0.310.0060.01115.41
7.0.300.0060.00615.34
7.0.290.0070.00715.31
7.0.280.0020.01115.38
7.0.270.0060.00715.40
7.0.260.0070.00815.40
7.0.250.0050.01015.46
7.0.240.0050.00915.47
7.0.230.0050.00815.50
7.0.220.0060.00915.38
7.0.210.0040.00915.49
7.0.200.0040.01015.66
7.0.190.0060.00815.63
7.0.180.0030.00915.54
7.0.170.0050.00915.70
7.0.160.0070.00715.58
7.0.150.0040.00815.52
7.0.140.0060.00815.55
7.0.130.0040.00915.61
7.0.120.0030.01015.62
7.0.110.0030.00915.57
7.0.100.0050.00915.58
7.0.90.0060.00815.58
7.0.80.0060.00815.54
7.0.70.0060.00815.49
7.0.60.0060.00615.46
7.0.50.0080.00515.76
7.0.40.0060.00713.80
7.0.30.0060.00713.93
7.0.20.0050.00714.00
7.0.10.0070.00514.00
7.0.00.0060.00813.90
5.6.400.0090.00814.47
5.6.390.0060.01014.47
5.6.380.0060.00914.63
5.6.370.0050.00914.38
5.6.360.0060.01014.44
5.6.350.0010.01314.50
5.6.340.0050.00814.38
5.6.330.0060.00714.59
5.6.320.0010.01414.45
5.6.310.0070.00514.40
5.6.300.0080.00714.26
5.6.290.0050.01014.38
5.6.280.0030.00914.54
5.6.270.0070.00414.48
5.6.260.0090.00714.42
5.6.250.0080.00814.51
5.6.240.0080.00814.55
5.6.230.0070.00814.53
5.6.220.0040.00814.36
5.6.210.0020.01214.51
5.6.200.0070.00514.57
5.6.190.0090.00514.48
5.6.180.0040.01114.46
5.6.170.0070.00514.30
5.6.160.0060.00814.54
5.6.150.0110.00314.52
5.6.140.0050.00814.35
5.6.130.0070.01114.38
5.6.120.0050.00614.43
5.6.110.0070.00714.46
5.6.100.0100.00414.41
5.6.90.0050.01014.36
5.6.80.0040.01114.56
5.6.70.0050.00614.41
5.6.60.0030.00814.38
5.6.50.0070.00514.46
5.6.40.0050.01014.42
5.6.30.0090.00714.42
5.6.20.0030.01014.36
5.6.10.0050.00714.33
5.6.00.0020.00914.31

preferences:
50.54 ms | 400 KiB | 5 Q