3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Bar implements ArraySerializableInterface{ private $event = 'test'; public function dismount() { $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)) { foreach ($value as $name => $foo) { if ($foo instanceof ArraySerializableInterface) { $array[$property->getName()][$name] = $foo->dismount(); } } continue; } $array[$property->getName()] = $property->getValue($object); $property->setAccessible(false); } return $array; } } class Foo { private $test = 'sd'; private $test2; /** * Constructor. */ public function __construct() { $this->test2 = [ new Bar(), new Bar(), new Bar(), new Bar(), ]; } public function getTest() { return $this->test; } public function getTest2() { return $this->test2; } public function dismount() { $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)) { foreach ($value as $name => $foo) { if ($foo instanceof ArraySerializableInterface) { $array[$property->getName()][$name] = $foo->dismount(); } } continue; } $array[$property->getName()] = $value; $property->setAccessible(false); } return $array; } } $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.0130.00316.63
8.3.50.0070.00716.49
8.3.40.0000.01518.97
8.3.30.0060.00918.74
8.3.20.0080.00020.30
8.3.10.0080.00021.90
8.3.00.0080.00020.81
8.2.180.0100.00618.29
8.2.170.0110.01118.95
8.2.160.0110.00322.96
8.2.150.0060.00325.66
8.2.140.0000.01024.66
8.2.130.0040.00422.25
8.2.120.0080.00026.35
8.2.110.0070.00321.04
8.2.100.0060.00617.89
8.2.90.0060.00317.75
8.2.80.0000.00818.05
8.2.70.0080.00017.93
8.2.60.0040.00418.22
8.2.50.0040.00418.10
8.2.40.0000.00719.47
8.2.30.0040.00419.31
8.2.20.0030.00618.00
8.2.10.0000.00818.19
8.2.00.0070.00018.11
8.1.280.0040.01125.92
8.1.270.0000.00823.91
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0070.00717.52
8.1.230.0060.00620.97
8.1.220.0030.00617.79
8.1.210.0000.00818.77
8.1.200.0060.00317.48
8.1.190.0000.00817.35
8.1.180.0060.00318.10
8.1.170.0050.00318.37
8.1.160.0000.00718.95
8.1.150.0000.00818.94
8.1.140.0000.00919.52
8.1.130.0030.00318.90
8.1.120.0040.00417.48
8.1.110.0040.00417.35
8.1.100.0030.00517.42
8.1.90.0040.00417.43
8.1.80.0040.00417.50
8.1.70.0000.00717.37
8.1.60.0080.00017.64
8.1.50.0040.00417.41
8.1.40.0040.00417.54
8.1.30.0030.00617.64
8.1.20.0000.00817.62
8.1.10.0040.00417.63
8.1.00.0080.00017.56
8.0.300.0000.00819.68
8.0.290.0030.00616.63
8.0.280.0000.00718.50
8.0.270.0040.00417.32
8.0.260.0040.00416.84
8.0.250.0000.00716.96
8.0.240.0000.00816.96
8.0.230.0040.00416.94
8.0.220.0000.00716.81
8.0.210.0040.00416.74
8.0.200.0060.00016.93
8.0.190.0030.00616.89
8.0.180.0000.00716.93
8.0.170.0050.00216.92
8.0.160.0040.00416.90
8.0.150.0030.00616.86
8.0.140.0000.00716.83
8.0.130.0050.00013.37
8.0.120.0040.00416.93
8.0.110.0040.00416.86
8.0.100.0000.00716.98
8.0.90.0070.00016.77
8.0.80.0070.01016.91
8.0.70.0020.00516.86
8.0.60.0000.00817.02
8.0.50.0040.00416.86
8.0.30.0130.00716.98
8.0.20.0110.00817.40
8.0.10.0040.00416.95
8.0.00.0100.00716.59
7.4.330.0030.00315.55
7.4.320.0000.00616.42
7.4.300.0030.00316.49
7.4.290.0000.00716.51
7.4.280.0060.00316.42
7.4.270.0050.00316.52
7.4.260.0000.00613.39
7.4.250.0000.00716.61
7.4.240.0080.00016.53
7.4.230.0000.00716.32
7.4.220.0130.00916.67
7.4.210.0080.00616.58
7.4.200.0040.00316.63
7.4.160.0090.00616.55
7.4.150.0090.00917.40
7.4.140.0140.00917.86
7.4.130.0130.00716.50
7.4.120.0090.01116.54
7.4.110.0120.00616.72
7.4.100.0140.00316.45
7.4.90.0130.00316.50
7.4.80.0180.00019.39
7.4.70.0090.00916.61
7.4.60.0080.00816.36
7.4.50.0060.00616.50
7.4.40.0060.00916.47
7.4.30.0060.01516.46
7.4.00.0060.00914.76
7.3.330.0000.00513.37
7.3.320.0060.00013.30
7.3.310.0000.00716.41
7.3.300.0030.00316.33
7.3.290.0090.00616.37
7.3.280.0110.00816.35
7.3.270.0170.00417.40
7.3.260.0110.00816.39
7.3.250.0120.00716.46
7.3.240.0100.00816.46
7.3.230.0160.00616.31
7.3.210.0100.00716.47
7.3.200.0120.00416.34
7.3.190.0080.00816.42
7.3.180.0060.01116.39
7.3.170.0130.00316.29
7.3.160.0140.00616.37
7.3.120.0120.00415.08
7.3.110.0060.00914.73
7.3.100.0070.00714.88
7.3.90.0030.01014.81
7.3.80.0040.00715.12
7.3.70.0100.00315.01
7.3.60.0070.00714.91
7.3.50.0090.00314.98
7.3.40.0030.01214.72
7.3.30.0110.00414.83
7.3.20.0000.00916.75
7.3.10.0070.00416.66
7.3.00.0030.01016.80
7.2.330.0030.01416.55
7.2.320.0060.01216.73
7.2.310.0080.00816.78
7.2.300.0100.00716.87
7.2.290.0100.00616.50
7.2.240.0030.01115.06
7.2.230.0100.00315.08
7.2.220.0100.00715.25
7.2.210.0130.00314.97
7.2.200.0030.00715.30
7.2.190.0130.00015.14
7.2.180.0090.00615.04
7.2.170.0030.01415.17
7.2.160.0080.00415.06
7.2.150.0030.01017.01
7.2.140.0030.00917.13
7.2.130.0040.01116.90
7.2.120.0060.00316.92
7.2.110.0040.01116.70
7.2.100.0110.00416.65
7.2.90.0080.00417.07
7.2.80.0130.00317.05
7.2.70.0080.00317.02
7.2.60.0070.00716.88
7.2.50.0060.00816.95
7.2.40.0060.00917.16
7.2.30.0000.01116.97
7.2.20.0090.00616.95
7.2.10.0120.00616.71
7.2.00.0060.01118.04
7.1.330.0030.01515.82
7.1.320.0090.00316.08
7.1.310.0070.00715.90
7.1.300.0000.01315.96
7.1.290.0040.01115.79
7.1.280.0080.00815.52
7.1.270.0070.00715.85
7.1.260.0030.00915.98
7.1.250.0000.01215.64
7.1.200.0050.00915.93
7.1.100.0000.01018.34
7.1.70.0130.00917.11
7.1.60.0370.00033.23
7.1.50.0330.01032.89
7.1.40.0270.02032.68
7.1.30.0300.01732.76
7.1.20.0500.02032.71
7.1.10.0230.00714.73
7.1.00.0130.01315.08
7.0.200.0170.01014.78
7.0.190.0200.01014.88
7.0.180.0300.01014.37
7.0.170.0970.01014.66
7.0.160.0330.00314.75
7.0.150.0270.01014.43
7.0.140.0270.00314.68
7.0.130.0230.01014.84
7.0.120.0170.01314.76
7.0.110.0100.00314.51
7.0.100.0230.01014.73
7.0.90.0070.01014.49
7.0.80.0200.00714.73
7.0.70.0270.01014.80
7.0.60.0070.00714.43
7.0.50.1130.02014.68
7.0.40.0170.01014.70
7.0.30.0200.01014.64
7.0.20.0230.00314.61
7.0.10.0200.00714.40
7.0.00.0130.01314.81

preferences:
48.04 ms | 401 KiB | 5 Q