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(), new Baz(), new Baz(), 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)) { //$this->foo($subValue, $property, $array); continue; } } } } $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.0170.00416.38
8.3.60.0070.01118.31
8.3.50.0120.00917.32
8.3.40.0100.00718.89
8.3.30.0130.00618.62
8.3.20.0080.00020.29
8.3.10.0000.00921.91
8.3.00.0000.00820.93
8.2.180.0090.00618.05
8.2.170.0090.00622.96
8.2.160.0070.00722.13
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00022.21
8.2.120.0050.00326.35
8.2.110.0130.00720.35
8.2.100.0080.00417.80
8.2.90.0050.00319.22
8.2.80.0050.00317.97
8.2.70.0050.00317.75
8.2.60.0070.00317.93
8.2.50.0000.00818.10
8.2.40.0050.00320.58
8.2.30.0040.00421.07
8.2.20.0000.00818.22
8.2.10.0080.00018.08
8.2.00.0050.00218.15
8.1.280.0110.01125.92
8.1.270.0040.00422.14
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0100.00020.62
8.1.230.0040.00719.22
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0030.00717.48
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0030.00518.55
8.1.160.0040.00419.00
8.1.150.0080.00020.55
8.1.140.0040.00419.68
8.1.130.0040.00419.00
8.1.120.0040.00417.39
8.1.110.0080.00017.39
8.1.100.0030.00617.49
8.1.90.0040.00417.46
8.1.80.0040.00417.56
8.1.70.0000.00817.50
8.1.60.0080.00017.55
8.1.50.0020.00517.56
8.1.40.0030.00517.46
8.1.30.0090.00017.68
8.1.20.0080.00017.57
8.1.10.0030.00517.59
8.1.00.0030.00617.62
8.0.300.0060.00318.77
8.0.290.0000.00816.75
8.0.280.0000.00718.54
8.0.270.0040.00417.25
8.0.260.0080.00016.80
8.0.250.0030.00317.03
8.0.240.0040.00417.06
8.0.230.0080.00017.06
8.0.220.0040.00417.06
8.0.210.0000.00716.84
8.0.200.0000.00817.07
8.0.190.0040.00417.05
8.0.180.0000.00717.05
8.0.170.0050.00316.93
8.0.160.0030.00516.98
8.0.150.0000.00817.00
8.0.140.0000.00716.85
8.0.130.0030.00313.48
8.0.120.0040.00416.86
8.0.110.0000.00817.00
8.0.100.0080.00017.05
8.0.90.0000.00916.99
8.0.80.0040.01417.07
8.0.70.0000.00816.95
8.0.60.0000.00717.04
8.0.50.0050.00217.01
8.0.30.0170.00317.15
8.0.20.0100.01217.40
8.0.10.0000.00816.90
8.0.00.0100.01016.71
7.4.330.0030.00315.55
7.4.320.0000.00616.68
7.4.300.0060.00016.64
7.4.290.0030.00316.65
7.4.280.0050.00316.45
7.4.270.0000.00716.64
7.4.260.0030.00413.34
7.4.250.0030.00316.51
7.4.240.0000.00716.54
7.4.230.0050.00316.72
7.4.220.0140.00616.51
7.4.210.0110.01116.60
7.4.200.0070.00016.53
7.4.160.0070.01316.59
7.4.150.0110.00817.40
7.4.140.0140.01417.86
7.4.130.0140.00716.62
7.4.120.0150.00716.45
7.4.110.0060.01216.61
7.4.100.0090.00916.41
7.4.90.0160.00316.40
7.4.80.0120.00619.39
7.4.70.0110.00816.66
7.4.60.0100.00716.38
7.4.50.0000.01516.61
7.4.40.0130.01016.52
7.4.30.0110.00716.48
7.4.00.0070.01115.15
7.3.330.0020.00213.40
7.3.320.0000.00513.36
7.3.310.0000.00716.21
7.3.300.0000.00716.40
7.3.290.0000.00816.36
7.3.280.0090.00816.40
7.3.270.0150.00617.40
7.3.260.0070.01416.75
7.3.250.0130.01016.45
7.3.240.0160.00616.43
7.3.230.0060.01216.55
7.3.210.0110.00716.39
7.3.200.0000.01616.26
7.3.190.0070.01016.67
7.3.180.0100.00716.76
7.3.170.0080.01216.52
7.3.160.0120.00616.39
7.3.10.0230.00416.50
7.3.00.0130.00816.70
7.2.330.0050.01416.85
7.2.320.0060.01816.63
7.2.310.0040.01516.72
7.2.300.0140.00316.46
7.2.290.0110.00716.76
7.2.130.0150.00416.86
7.2.120.0090.01316.58
7.2.110.0200.00816.69
7.2.100.0080.00816.29
7.2.90.0110.00516.44
7.2.80.0180.00916.86
7.2.70.0200.01016.86
7.2.60.0130.00716.68
7.2.50.0110.00716.74
7.2.40.0110.01116.52
7.2.30.0170.01316.63
7.2.20.0180.01216.47
7.2.10.0200.01916.96
7.2.00.0050.01517.95
7.1.250.0140.00715.54
7.1.200.0060.00315.62
7.1.100.0060.00618.30
7.1.70.0030.00517.16
7.1.60.0700.01033.05
7.1.50.0530.01732.78
7.1.40.0530.00732.79
7.1.30.0500.01332.77
7.1.20.0530.01032.95
7.1.10.0330.01314.78
7.1.00.0400.01014.65
7.0.200.0570.01014.71
7.0.190.0400.00714.79
7.0.180.0370.00714.52
7.0.170.0430.00714.39
7.0.160.0470.00714.40
7.0.150.0430.00314.26
7.0.140.0370.01014.47
7.0.130.0430.00714.90
7.0.120.0430.00714.78
7.0.110.0670.01014.49
7.0.100.0470.00314.46
7.0.90.0400.01014.55
7.0.80.0370.01014.51
7.0.70.0330.01314.46
7.0.60.0430.01314.47
7.0.50.0430.01014.64
7.0.40.0400.00714.76
7.0.30.0470.01014.84
7.0.20.0370.01014.61
7.0.10.0330.01314.55
7.0.00.0830.00714.82

preferences:
60.06 ms | 401 KiB | 5 Q