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.0120.00618.31
8.3.50.0110.00416.40
8.3.40.0070.01018.67
8.3.30.0120.00318.70
8.3.20.0040.00420.28
8.3.10.0040.00421.86
8.3.00.0090.00020.74
8.2.180.0110.00718.42
8.2.170.0040.01122.96
8.2.160.0090.00622.08
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0170.00022.08
8.2.120.0050.00226.35
8.2.110.0050.00520.43
8.2.100.0040.00817.84
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0080.00017.91
8.2.50.0080.00018.10
8.2.40.0080.00020.42
8.2.30.0080.00021.13
8.2.20.0090.00018.30
8.2.10.0040.00418.19
8.2.00.0000.00918.25
8.1.280.0170.00325.92
8.1.270.0060.00322.12
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0040.00420.89
8.1.230.0080.00419.16
8.1.220.0080.00017.78
8.1.210.0030.00518.77
8.1.200.0030.00617.35
8.1.190.0040.00417.13
8.1.180.0080.00018.10
8.1.170.0080.00018.46
8.1.160.0070.00019.01
8.1.150.0050.00320.72
8.1.140.0000.00819.63
8.1.130.0000.00718.89
8.1.120.0030.00517.57
8.1.110.0040.00417.50
8.1.100.0040.00417.52
8.1.90.0030.00517.57
8.1.80.0000.00717.54
8.1.70.0030.00317.53
8.1.60.0060.00317.54
8.1.50.0050.00317.54
8.1.40.0060.00317.46
8.1.30.0030.00517.54
8.1.20.0060.00317.53
8.1.10.0030.00517.56
8.1.00.0030.00617.55
8.0.300.0080.00018.77
8.0.290.0040.00417.00
8.0.280.0070.00018.41
8.0.270.0000.00717.35
8.0.260.0040.00416.95
8.0.250.0000.00717.09
8.0.240.0030.00616.90
8.0.230.0000.00717.02
8.0.220.0030.00316.89
8.0.210.0070.00016.98
8.0.200.0030.00317.00
8.0.190.0030.00617.04
8.0.180.0040.00417.04
8.0.170.0000.00717.09
8.0.160.0030.00616.98
8.0.150.0080.00016.96
8.0.140.0000.00716.86
8.0.130.0060.00013.41
8.0.120.0050.00217.00
8.0.110.0040.00416.91
8.0.100.0000.00816.95
8.0.90.0050.00217.02
8.0.80.0100.01516.97
8.0.70.0000.00716.96
8.0.60.0060.00316.88
8.0.50.0030.00516.86
8.0.30.0130.00817.05
8.0.20.0130.01017.40
8.0.10.0040.00417.19
8.0.00.0090.00916.84
7.4.330.0050.00015.55
7.4.320.0000.00716.64
7.4.300.0000.00716.55
7.4.290.0080.00016.63
7.4.280.0040.00416.64
7.4.270.0040.00416.56
7.4.260.0050.00213.44
7.4.250.0000.00716.66
7.4.240.0050.00216.68
7.4.230.0070.00016.68
7.4.220.0100.01016.40
7.4.210.0060.01116.69
7.4.200.0070.00016.71
7.4.160.0150.00616.44
7.4.150.0160.00317.40
7.4.140.0170.00717.86
7.4.130.0150.01116.46
7.4.120.0120.01116.54
7.4.110.0060.01416.63
7.4.100.0070.01016.42
7.4.90.0090.00916.42
7.4.80.0060.01219.39
7.4.70.0070.01116.42
7.4.60.0060.00916.43
7.4.50.0030.01016.51
7.4.40.0130.00416.62
7.4.30.0090.00916.63
7.4.00.0100.00614.91
7.3.330.0000.00513.21
7.3.320.0000.00513.23
7.3.310.0030.00316.43
7.3.300.0030.00316.29
7.3.290.0030.00316.43
7.3.280.0070.01016.40
7.3.270.0160.00317.40
7.3.260.0110.00916.62
7.3.250.0140.00816.38
7.3.240.0110.01016.47
7.3.230.0070.01116.36
7.3.210.0090.00916.38
7.3.200.0140.01016.39
7.3.190.0100.01016.48
7.3.180.0070.01016.68
7.3.170.0110.00716.42
7.3.160.0030.01616.62
7.3.120.0140.00314.92
7.3.110.0120.00614.69
7.3.100.0140.00314.95
7.3.90.0030.01015.19
7.3.80.0060.00914.84
7.3.70.0040.00714.61
7.3.60.0060.00615.03
7.3.50.0000.01614.94
7.3.40.0000.01415.05
7.3.30.0060.00314.91
7.3.20.0080.00816.74
7.3.10.0120.00716.34
7.3.00.0050.00916.41
7.2.330.0120.00816.79
7.2.320.0130.01016.88
7.2.310.0030.01416.50
7.2.300.0070.01116.80
7.2.290.0100.00616.88
7.2.250.0100.00315.29
7.2.240.0060.01514.84
7.2.230.0000.01914.91
7.2.220.0000.01115.10
7.2.210.0090.00615.24
7.2.200.0030.00915.00
7.2.190.0060.00615.16
7.2.180.0030.01314.98
7.2.170.0030.01014.83
7.2.130.0140.00316.63
7.2.120.0060.00916.50
7.2.110.0040.01616.32
7.2.100.0090.01216.54
7.2.90.0080.01216.23
7.2.80.0170.00716.60
7.2.70.0060.01616.56
7.2.60.0100.00516.92
7.2.50.0160.00716.50
7.2.40.0100.01016.86
7.2.30.0100.00716.49
7.2.20.0100.01016.63
7.2.10.0100.01016.63
7.2.00.0100.01316.77
7.1.330.0030.01015.55
7.1.320.0040.00816.05
7.1.310.0070.00715.98
7.1.300.0000.01515.82
7.1.290.0000.00915.92
7.1.280.0110.00015.64
7.1.270.0130.00315.59
7.1.260.0090.00315.76
7.1.250.0120.00615.43
7.1.200.0080.00415.91
7.1.100.0090.00317.92
7.1.70.0080.00816.71
7.1.60.0430.01033.47
7.1.50.0370.01332.91
7.1.40.0430.01032.68
7.1.30.0370.01332.47
7.1.20.0400.01032.99
7.1.10.0270.02014.72
7.1.00.0270.00714.91
7.0.200.0230.01314.96
7.0.190.0170.01315.04
7.0.180.0330.01014.63
7.0.170.0200.01314.56
7.0.160.0270.00714.40
7.0.150.0300.00314.38
7.0.140.0200.01014.46
7.0.130.0230.01014.67
7.0.120.0270.00714.68
7.0.110.0230.01014.60
7.0.100.1030.00714.50
7.0.90.0270.01014.45
7.0.80.0270.01014.74
7.0.70.0230.01314.59
7.0.60.0230.01014.43
7.0.50.0300.00314.65
7.0.40.0230.01014.65
7.0.30.0200.01314.71
7.0.20.0470.01014.59
7.0.10.0300.00714.58
7.0.00.0270.01014.80

preferences:
48.92 ms | 400 KiB | 5 Q