3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Bar { 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()][] = $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()][] = $foo->dismount(); } } continue; } $array[$property->getName()] = $property->getValue($object); $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.0140.00316.38
8.3.50.0070.01416.29
8.3.40.0040.01118.64
8.3.30.0070.00718.67
8.3.20.0050.00220.34
8.3.10.0070.00021.75
8.3.00.0000.00720.95
8.2.180.0120.00918.41
8.2.170.0100.00322.96
8.2.160.0100.00722.09
8.2.150.0000.00724.18
8.2.140.0000.00824.66
8.2.130.0070.00022.20
8.2.120.0040.00426.35
8.2.110.0080.00322.12
8.2.100.0120.00017.84
8.2.90.0050.00319.34
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0070.00317.80
8.2.50.0040.00418.10
8.2.40.0040.00420.57
8.2.30.0060.00321.09
8.2.20.0040.00418.12
8.2.10.0050.00218.05
8.2.00.0040.00418.13
8.1.280.0160.00325.92
8.1.270.0050.00323.88
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00323.97
8.1.230.0080.00322.25
8.1.220.0030.00617.74
8.1.210.0080.00018.77
8.1.200.0050.00517.35
8.1.190.0040.00717.11
8.1.180.0030.00518.10
8.1.170.0030.00618.54
8.1.160.0000.00718.90
8.1.150.0040.00418.96
8.1.140.0040.00419.50
8.1.130.0030.00318.90
8.1.120.0040.00417.55
8.1.110.0070.00017.40
8.1.100.0030.00517.46
8.1.90.0080.00017.35
8.1.80.0040.00417.53
8.1.70.0050.00317.36
8.1.60.0000.00817.58
8.1.50.0060.00317.45
8.1.40.0060.00317.52
8.1.30.0050.00317.54
8.1.20.0000.00817.59
8.1.10.0030.00517.60
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00718.53
8.0.270.0030.00317.22
8.0.260.0070.00016.88
8.0.250.0000.00616.95
8.0.240.0040.00417.00
8.0.230.0000.00716.97
8.0.220.0030.00316.89
8.0.210.0030.00316.86
8.0.200.0040.00416.83
8.0.190.0000.00816.98
8.0.180.0040.00416.93
8.0.170.0030.00316.99
8.0.160.0000.00716.98
8.0.150.0050.00316.83
8.0.140.0040.00316.86
8.0.130.0050.00013.35
8.0.120.0000.00816.75
8.0.110.0000.00816.80
8.0.100.0050.00216.93
8.0.90.0000.00816.73
8.0.80.0120.00316.84
8.0.70.0000.00816.79
8.0.60.0000.00816.89
8.0.50.0040.00416.89
8.0.30.0090.01017.09
8.0.20.0070.01417.40
8.0.10.0000.00717.08
8.0.00.0130.00316.80
7.4.330.0050.00015.55
7.4.320.0030.00316.60
7.4.300.0070.00016.52
7.4.290.0000.00716.44
7.4.280.0000.00816.52
7.4.270.0000.00716.50
7.4.260.0030.00313.24
7.4.250.0030.00316.60
7.4.240.0030.00316.38
7.4.230.0000.00716.59
7.4.220.0110.00716.63
7.4.210.0120.00916.55
7.4.200.0000.00716.61
7.4.160.0050.01116.51
7.4.150.0100.01017.40
7.4.140.0090.01117.86
7.4.130.0060.01316.56
7.4.120.0070.01616.50
7.4.110.0090.01216.39
7.4.100.0170.00416.57
7.4.90.0070.01016.64
7.4.80.0090.01319.39
7.4.70.0100.00616.61
7.4.60.0090.00916.60
7.4.50.0000.01416.46
7.4.40.0140.00316.71
7.4.30.0090.00916.41
7.4.00.0060.01114.84
7.3.330.0050.00013.44
7.3.320.0000.00513.33
7.3.310.0070.00016.38
7.3.300.0070.00016.33
7.3.290.0050.00916.37
7.3.280.0080.00816.35
7.3.270.0120.01217.40
7.3.260.0100.00916.60
7.3.250.0090.01116.54
7.3.240.0080.00916.43
7.3.230.0090.01116.34
7.3.210.0080.00816.35
7.3.200.0070.01016.39
7.3.190.0100.00716.55
7.3.180.0060.01016.45
7.3.170.0090.00616.53
7.3.160.0060.00916.34
7.3.120.0060.01214.93
7.3.110.0060.00914.94
7.3.100.0080.00714.89
7.3.90.0060.00814.68
7.3.80.0040.01214.96
7.3.70.0040.00714.89
7.3.60.0070.00714.90
7.3.50.0070.00614.82
7.3.40.0060.01014.74
7.3.30.0080.00614.82
7.3.20.0060.00715.99
7.3.10.0070.01016.08
7.3.00.0060.00716.07
7.2.330.0150.00316.73
7.2.320.0150.00316.50
7.2.310.0140.00316.91
7.2.300.0090.00916.84
7.2.290.0090.00916.59
7.2.250.0000.01514.93
7.2.240.0060.00715.15
7.2.230.0060.00914.99
7.2.220.0120.00315.07
7.2.210.0100.00615.03
7.2.200.0050.00815.05
7.2.190.0080.00815.07
7.2.180.0080.00615.18
7.2.170.0030.01115.05
7.2.160.0050.01015.05
7.2.150.0080.00816.41
7.2.140.0070.00616.37
7.2.130.0080.00416.39
7.2.120.0040.01016.38
7.2.110.0110.00716.25
7.2.100.0040.01016.12
7.2.90.0060.00916.16
7.2.80.0020.01216.33
7.2.70.0100.00716.86
7.2.60.0070.00716.87
7.2.50.0060.00816.88
7.2.40.0050.00817.03
7.2.30.0060.01016.96
7.2.20.0060.01216.98
7.2.10.0070.00816.89
7.2.00.0120.00416.75
7.1.330.0070.00815.08
7.1.320.0080.00715.29
7.1.310.0060.00615.18
7.1.300.0040.00815.22
7.1.290.0090.00715.17
7.1.280.0110.00315.10
7.1.270.0020.01015.23
7.1.260.0060.00815.11
7.1.250.0040.01015.18
7.1.240.0150.00314.91
7.1.230.0120.00614.90
7.1.220.0060.01014.81
7.1.210.0050.01314.85
7.1.200.0050.01014.99
7.1.190.0090.00415.67
7.1.180.0070.00815.67
7.1.170.0090.00615.75
7.1.160.0050.01115.52
7.1.150.0060.01015.71
7.1.140.0110.00815.81
7.1.130.0050.01015.79
7.1.120.0080.00815.64
7.1.110.0090.00515.82
7.1.100.0040.00816.54
7.1.90.0100.00615.41
7.1.80.0090.00515.62
7.1.70.0100.00416.26
7.1.60.0310.00821.56
7.1.50.0260.01021.54
7.1.40.0350.00921.44
7.1.30.0150.01221.16
7.1.20.0340.00721.22
7.1.10.0270.00615.49
7.1.00.0220.01015.39
7.0.330.0120.00514.54
7.0.320.0130.00414.47
7.0.310.0090.00814.61
7.0.300.0080.00515.24
7.0.290.0110.00915.29
7.0.280.0110.00515.40
7.0.270.0110.00315.37
7.0.260.0120.00315.42
7.0.250.0080.00915.50
7.0.240.0080.00815.29
7.0.230.0090.00715.29
7.0.220.0110.00415.39
7.0.210.0060.00915.47
7.0.200.0270.00815.27
7.0.190.0090.00715.07
7.0.180.0260.01015.10
7.0.170.0090.01215.06
7.0.160.0300.00514.95
7.0.150.0090.00615.06
7.0.140.0060.01115.11
7.0.130.0280.00715.22
7.0.120.0260.00815.18
7.0.110.0080.00915.22
7.0.100.0280.00715.05
7.0.90.0300.00714.47
7.0.80.0290.00514.54
7.0.70.0180.00814.50
7.0.60.0160.01214.47
7.0.50.0090.00814.56
7.0.40.0270.00813.91
7.0.30.0280.00713.91
7.0.20.0320.00713.90
7.0.10.0250.01314.04
7.0.00.0260.00713.98
5.6.400.0110.01014.50
5.6.390.0050.01214.51
5.6.380.0160.00414.43
5.6.370.0040.00414.64
5.6.360.0030.01314.59
5.6.350.0120.00014.73
5.6.340.0080.00314.69
5.6.330.0030.00914.31
5.6.320.0140.00014.62
5.6.310.0030.01014.46
5.6.300.0070.00714.48
5.6.290.0090.00914.74
5.6.280.0030.01214.36
5.6.270.0080.00314.77
5.6.260.0040.01214.55
5.6.250.0130.00014.24
5.6.240.0060.00614.59
5.6.230.0070.00314.66
5.6.220.0040.01114.75
5.6.210.0030.01314.25
5.6.200.0070.00714.32
5.6.190.0120.00314.55
5.6.180.0000.01414.46
5.6.170.0070.00714.78
5.6.160.0050.00514.24
5.6.150.0030.01014.40
5.6.140.0060.00914.45
5.6.130.0090.00614.58
5.6.120.0120.00314.33
5.6.110.0030.00714.48
5.6.100.0030.01014.27
5.6.90.0000.01814.65
5.6.80.0080.00814.26
5.6.70.0110.00414.34
5.6.60.0030.01014.39
5.6.50.0030.00614.37
5.6.40.0060.00314.52
5.6.30.0060.00914.58
5.6.20.0120.00314.52
5.6.10.0060.00914.31
5.6.00.0030.01014.63

preferences:
30.14 ms | 401 KiB | 5 Q