3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Baz { private $event = 'test'; } 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; print_r( $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.0110.01118.30
8.3.50.0110.00316.70
8.3.40.0120.00318.70
8.3.30.0070.01418.75
8.3.20.0070.00720.27
8.3.10.0090.00021.90
8.3.00.0080.00020.89
8.2.180.0110.00418.17
8.2.170.0090.00622.96
8.2.160.0000.01322.12
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00022.30
8.2.120.0090.00626.35
8.2.110.0120.00922.22
8.2.100.0030.00917.91
8.2.90.0080.00018.22
8.2.80.0000.00919.11
8.2.70.0040.00417.63
8.2.60.0030.00617.93
8.2.50.0040.00418.10
8.2.40.0090.00022.15
8.2.30.0040.00421.02
8.2.20.0080.00018.18
8.2.10.0040.00418.06
8.2.00.0000.00718.16
8.1.280.0140.00325.92
8.1.270.0040.00422.13
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0050.00523.92
8.1.230.0110.00520.93
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0000.00917.35
8.1.190.0030.00617.35
8.1.180.0000.00818.10
8.1.170.0000.00818.70
8.1.160.0070.00019.06
8.1.150.0060.00320.58
8.1.140.0000.00719.68
8.1.130.0000.00718.93
8.1.120.0000.00717.48
8.1.110.0060.00317.49
8.1.100.0040.00417.55
8.1.90.0040.00417.45
8.1.80.0000.00717.52
8.1.70.0040.00417.39
8.1.60.0000.00817.49
8.1.50.0000.00817.43
8.1.40.0000.00817.56
8.1.30.0040.00417.66
8.1.20.0030.00517.67
8.1.10.0000.00817.56
8.1.00.0040.00417.44
8.0.300.0000.00820.30
8.0.290.0030.00516.75
8.0.280.0000.00718.54
8.0.270.0070.00017.27
8.0.260.0000.00716.84
8.0.250.0030.00316.95
8.0.240.0000.00817.09
8.0.230.0060.00317.09
8.0.220.0000.00716.91
8.0.210.0000.00716.94
8.0.200.0030.00317.10
8.0.190.0050.00316.94
8.0.180.0040.00417.04
8.0.170.0000.00716.98
8.0.160.0000.00816.88
8.0.150.0060.00316.96
8.0.140.0000.00716.98
8.0.130.0030.00313.39
8.0.120.0040.00416.94
8.0.110.0080.00017.02
8.0.100.0050.00316.79
8.0.90.0090.00016.98
8.0.80.0030.01217.03
8.0.70.0040.00417.02
8.0.60.0040.00416.91
8.0.50.0000.00817.11
8.0.30.0120.00816.93
8.0.20.0110.01217.42
8.0.10.0050.00217.18
8.0.00.0070.01016.77
7.4.330.0020.00215.55
7.4.320.0030.00316.57
7.4.300.0060.00016.65
7.4.290.0030.00316.62
7.4.280.0040.00416.63
7.4.270.0000.00716.54
7.4.260.0030.00313.31
7.4.250.0030.00316.55
7.4.240.0030.00316.67
7.4.230.0050.00216.65
7.4.220.0090.00916.57
7.4.210.0090.01116.66
7.4.200.0030.00316.37
7.4.160.0090.00716.51
7.4.150.0120.00617.40
7.4.140.0110.00817.86
7.4.130.0060.01616.52
7.4.120.0130.01016.59
7.4.110.0130.00316.64
7.4.100.0100.01316.57
7.4.90.0080.01116.68
7.4.80.0100.00719.39
7.4.70.0080.00816.55
7.4.60.0060.01216.65
7.4.50.0040.01216.69
7.4.40.0100.00716.62
7.4.30.0030.01516.52
7.4.10.0000.01515.30
7.4.00.0040.01115.10
7.3.330.0020.00213.22
7.3.320.0000.00513.41
7.3.310.0000.00716.25
7.3.300.0030.00316.45
7.3.290.0030.00516.41
7.3.280.0070.00916.41
7.3.270.0100.00717.40
7.3.260.0120.01016.67
7.3.250.0140.00616.61
7.3.240.0140.00816.52
7.3.230.0090.00916.38
7.3.210.0030.01316.53
7.3.200.0060.01216.66
7.3.190.0060.00916.63
7.3.180.0150.00016.42
7.3.170.0090.01316.47
7.3.160.0150.00316.57
7.3.130.0090.00915.30
7.3.120.0000.01815.30
7.3.110.0090.00915.30
7.3.100.0100.00015.30
7.3.90.0070.01015.30
7.3.80.0040.00415.30
7.3.70.0110.00415.30
7.3.60.0070.00715.30
7.3.50.0000.00915.30
7.3.40.0030.01415.30
7.3.30.0030.01015.30
7.3.20.0030.00916.75
7.3.10.0070.00716.55
7.3.00.0130.00016.80
7.2.330.0030.01316.89
7.2.320.0090.00916.93
7.2.310.0040.01816.81
7.2.300.0060.01116.62
7.2.290.0070.01016.55
7.2.260.0040.01115.37
7.2.250.0040.01115.30
7.2.240.0030.01015.30
7.2.230.0030.00915.30
7.2.220.0110.00715.30
7.2.210.0000.00915.30
7.2.200.0120.00315.30
7.2.190.0030.00915.30
7.2.180.0000.01515.30
7.2.170.0000.01415.30
7.2.160.0050.00515.30
7.2.150.0000.00916.89
7.2.140.0080.00817.00
7.2.130.0030.00916.86
7.2.120.0070.00316.84
7.2.110.0040.00816.82
7.2.100.0100.00616.86
7.2.90.0100.00716.90
7.2.80.0070.01416.95
7.2.70.0040.00716.91
7.2.60.0080.00616.94
7.2.50.0060.01217.09
7.2.40.0070.00716.43
7.2.30.0110.00717.05
7.2.20.0100.00616.79
7.2.10.0030.01516.98
7.2.00.0040.00817.94
7.1.330.0060.00915.89
7.1.320.0120.00815.48
7.1.310.0040.00715.71
7.1.300.0040.01215.84
7.1.290.0000.01715.85
7.1.280.0030.01015.64
7.1.270.0030.00515.94
7.1.260.0070.00715.52
7.1.250.0100.00315.78
7.1.240.0070.00415.90
7.1.230.0040.01115.93
7.1.220.0070.00715.77
7.1.210.0130.00015.83
7.1.200.0060.00715.88
7.1.190.0120.00515.88
7.1.180.0100.00515.93
7.1.170.0000.01415.98
7.1.160.0060.00915.83
7.1.150.0030.01315.95
7.1.140.0100.00015.73
7.1.130.0080.00815.72
7.1.120.0090.00015.83
7.1.110.0030.01215.52
7.1.100.0070.00516.85
7.1.90.0030.00615.78
7.1.80.0060.00615.75
7.1.70.0130.00316.43
7.1.60.0200.01024.62
7.1.50.0240.01024.44
7.1.40.0170.01424.11
7.1.30.0220.01024.29
7.1.20.0260.00824.09
7.1.10.0930.01115.18
7.1.00.0080.00815.27
7.0.330.0120.00615.34
7.0.320.0060.01215.30
7.0.310.0100.01015.30
7.0.300.0140.00415.30
7.0.290.0060.00915.52
7.0.280.0090.00315.54
7.0.270.0070.01015.30
7.0.260.0100.01015.30
7.0.250.0000.01415.30
7.0.240.0150.00715.38
7.0.230.0070.01015.60
7.0.220.0120.00015.30
7.0.210.0070.01115.40
7.0.200.0190.01215.27
7.0.190.0200.00715.13
7.0.180.0100.02114.79
7.0.170.0180.01215.02
7.0.160.0130.01214.86
7.0.150.0280.01114.92
7.0.140.0180.01315.17
7.0.130.0180.00715.16
7.0.120.0220.00715.05
7.0.110.0170.01215.04
7.0.100.0190.00615.09
7.0.90.0180.01014.97
7.0.80.0120.01015.89
7.0.70.0100.00815.88
7.0.60.0050.01015.78
7.0.50.0090.00915.94
7.0.40.0100.01215.86
7.0.30.0140.00515.87
7.0.20.0090.01115.81
7.0.10.0080.01015.79
7.0.00.0110.00915.81
5.6.400.0090.00915.30
5.6.390.0120.00915.30
5.6.380.0180.00015.30
5.6.370.0070.01415.30
5.6.360.0070.01115.30
5.6.350.0070.01315.30
5.6.340.0030.01215.30
5.6.330.0060.00915.30
5.6.320.0000.02015.30
5.6.310.0070.01115.30
5.6.300.0090.00615.30
5.6.290.0090.00315.30
5.6.280.0060.01315.30
5.6.270.0180.00015.30
5.6.260.0110.00715.30
5.6.250.0040.00815.30
5.6.240.0200.00715.30
5.6.230.0100.00615.30
5.6.220.0090.01215.30
5.6.210.0000.01515.30
5.6.200.0060.00915.30
5.6.190.0060.00915.30
5.6.180.0120.00315.30
5.6.170.0060.00615.30
5.6.160.0080.00815.30
5.6.150.0030.01315.30
5.6.140.0070.01115.30
5.6.130.0100.00315.30
5.6.120.0130.00015.30
5.6.110.0070.00715.30
5.6.100.0120.00915.30
5.6.90.0100.00715.30
5.6.80.0070.01515.30
5.6.70.0140.00715.30
5.6.60.0070.01515.30
5.6.50.0030.01015.30
5.6.40.0090.00915.30
5.6.30.0040.01115.30
5.6.20.0120.00615.30
5.6.10.0030.01415.30
5.6.00.0150.00615.30

preferences:
58.94 ms | 401 KiB | 5 Q