3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $test = 'sd'; private $test2; /** * Constructor. */ public function __construct() { $this->test2 = [ new \stdClass(), new \stdClass(), new \stdClass(), new \stdClass(), ]; } public function dismount() { $object = $this; $reflectionClass = new ReflectionClass(get_class($object)); $array = array(); foreach ($reflectionClass->getProperties() as $property) { $property->setAccessible(true); $array[$property->getName()] = $property->getValue($object); $property->setAccessible(false); } return $array; } public function entity2array($entity, $recursionDepth = 2) { $result = array(); $class = new ReflectionClass(get_class($entity)); foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { $methodName = $method->name; if (strpos($methodName, "get") === 0 && strlen($methodName) > 3) { $propertyName = lcfirst(substr($methodName, 3)); $value = $method->invoke($entity); if (is_object($value)) { if ($recursionDepth > 0) { $result[$propertyName] = $this->entity2array($value, $recursionDepth - 1); } else { $result[$propertyName] = "***"; //stop recursion } } else { $result[$propertyName] = $value; } } } return $result; } } $foo = new Foo; print_r( $foo->entity2array());

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.00616.63
8.3.50.0120.00316.14
8.3.40.0150.00318.82
8.3.30.0130.00318.92
8.3.20.0040.00420.34
8.3.10.0000.00921.80
8.3.00.0030.00620.94
8.2.180.0000.01818.38
8.2.170.0140.00322.96
8.2.160.0030.01322.16
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0070.00022.21
8.2.120.0000.00826.35
8.2.110.0030.00620.52
8.2.100.0090.00317.91
8.2.90.0000.00819.09
8.2.80.0030.00517.97
8.2.70.0000.00817.63
8.2.60.0000.00817.92
8.2.50.0040.00418.10
8.2.40.0050.00322.20
8.2.30.0050.00320.91
8.2.20.0000.00817.97
8.2.10.0000.00817.98
8.2.00.0040.00418.00
8.1.280.0070.00725.92
8.1.270.0040.00423.83
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0100.00020.92
8.1.230.0120.00019.06
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0040.00417.48
8.1.190.0090.00017.23
8.1.180.0000.00718.10
8.1.170.0030.00518.57
8.1.160.0040.00419.04
8.1.150.0040.00420.68
8.1.140.0040.00419.54
8.1.130.0050.00317.39
8.1.120.0000.00717.49
8.1.110.0040.00417.50
8.1.100.0000.00717.49
8.1.90.0040.00417.39
8.1.80.0040.00417.46
8.1.70.0000.00717.52
8.1.60.0040.00417.54
8.1.50.0040.00417.57
8.1.40.0000.00817.57
8.1.30.0000.00817.71
8.1.20.0040.00417.63
8.1.10.0060.00317.68
8.1.00.0050.00217.52
8.0.300.0070.00018.77
8.0.290.0000.00816.88
8.0.280.0040.00418.46
8.0.270.0000.00717.20
8.0.260.0030.00316.79
8.0.250.0030.00316.99
8.0.240.0020.00517.01
8.0.230.0000.00817.06
8.0.220.0070.00016.97
8.0.210.0030.00316.96
8.0.200.0030.00317.04
8.0.190.0040.00417.09
8.0.180.0000.00717.00
8.0.170.0040.00417.02
8.0.160.0050.00316.97
8.0.150.0000.00816.92
8.0.140.0030.00516.95
8.0.130.0030.00313.45
8.0.120.0040.00416.86
8.0.110.0000.00716.95
8.0.100.0040.00417.10
8.0.90.0040.00416.80
8.0.80.0090.00916.98
8.0.70.0050.00316.88
8.0.60.0000.00817.01
8.0.50.0000.00716.92
8.0.30.0080.01117.40
8.0.20.0120.00917.40
8.0.10.0040.00417.15
8.0.00.0030.01516.98
7.4.330.0020.00215.55
7.4.320.0030.00316.46
7.4.300.0000.00616.50
7.4.290.0000.00716.39
7.4.280.0000.00816.50
7.4.270.0000.00816.68
7.4.260.0000.00613.27
7.4.250.0050.00216.52
7.4.240.0000.00816.66
7.4.230.0000.00716.38
7.4.220.0070.01016.73
7.4.210.0040.01016.53
7.4.200.0030.00316.66
7.4.160.0080.00916.53
7.4.150.0090.00917.40
7.4.140.0070.01117.86
7.4.130.0130.00716.62
7.4.120.0140.00716.57
7.4.110.0130.01016.54
7.4.100.0090.00916.72
7.4.90.0120.01416.64
7.4.80.0160.00619.39
7.4.70.0100.00716.58
7.4.60.0090.01316.75
7.4.50.0030.00916.57
7.4.40.0130.00316.28
7.4.30.0090.01316.51
7.4.10.0070.01014.79
7.4.00.0070.00815.15
7.3.330.0000.00513.20
7.3.320.0000.00513.36
7.3.310.0070.00016.36
7.3.300.0000.00716.22
7.3.290.0070.00016.23
7.3.280.0090.00716.34
7.3.270.0140.00717.40
7.3.260.0090.01016.58
7.3.250.0110.00916.50
7.3.240.0110.00916.31
7.3.230.0130.00316.60
7.3.210.0040.01616.53
7.3.200.0070.01316.45
7.3.190.0030.01316.57
7.3.180.0100.01016.55
7.3.170.0130.00316.45
7.3.160.0100.00716.52
7.3.130.0100.00314.59
7.3.120.0060.01014.82
7.3.110.0110.00415.04
7.3.100.0110.00414.95
7.3.90.0040.00414.90
7.3.80.0000.01514.59
7.3.70.0070.00714.82
7.3.60.0060.00614.63
7.3.50.0080.01114.71
7.3.40.0130.00414.79
7.3.30.0120.00314.75
7.3.20.0000.01416.64
7.3.10.0090.00616.32
7.3.00.0030.01016.70
7.2.330.0170.00316.38
7.2.320.0160.00716.81
7.2.310.0100.00616.85
7.2.300.0060.01216.54
7.2.290.0180.00316.65
7.2.260.0070.01015.03
7.2.250.0070.01015.04
7.2.240.0070.00714.90
7.2.230.0000.01214.94
7.2.220.0000.00815.31
7.2.210.0040.00815.11
7.2.200.0070.00715.15
7.2.190.0090.00614.80
7.2.180.0090.00615.12
7.2.170.0070.00415.10
7.2.160.0000.01715.21
7.2.150.0060.00917.07
7.2.140.0040.00816.88
7.2.130.0060.00316.82
7.2.120.0090.00616.70
7.2.110.0050.00516.86
7.2.100.0050.00516.73
7.2.90.0030.01417.00
7.2.80.0090.00917.12
7.2.70.0050.00516.96
7.2.60.0020.01116.90
7.2.50.0070.00716.84
7.2.40.0090.00616.89
7.2.30.0070.00716.89
7.2.20.0030.00916.55
7.2.10.0110.00416.91
7.2.00.0030.00716.98
7.1.330.0030.00715.70
7.1.320.0070.01015.95
7.1.310.0030.00615.72
7.1.300.0070.01015.91
7.1.290.0040.01415.71
7.1.280.0040.00715.65
7.1.270.0000.01215.63
7.1.260.0000.01115.63
7.1.250.0030.00615.71
7.1.240.0030.00515.74
7.1.230.0040.00415.73
7.1.220.0000.00915.72
7.1.210.0040.00815.65
7.1.200.0030.00915.72
7.1.190.0030.00915.81
7.1.180.0040.00715.59
7.1.170.0050.00315.42
7.1.160.0070.00315.57
7.1.150.0090.00615.60
7.1.140.0090.00315.78
7.1.130.0070.00715.61
7.1.120.0030.00915.79
7.1.110.0000.01015.59
7.1.100.0030.00615.74
7.1.90.0000.01515.44
7.1.80.0100.00315.72
7.1.70.0000.00816.14
7.1.60.0250.00924.52
7.1.50.0250.00724.21
7.1.40.0280.00324.02
7.1.30.0240.00924.12
7.1.20.0230.01224.10
7.1.10.0150.01015.22
7.1.00.0230.00915.19
7.0.330.0060.00615.54
7.0.320.0030.00915.56
7.0.310.0060.00615.29
7.0.300.0050.00315.46
7.0.290.0030.00915.47
7.0.280.0030.00615.23
7.0.270.0000.00915.41
7.0.260.0040.01115.07
7.0.250.0030.00915.61
7.0.240.0120.00015.58
7.0.230.0030.01015.56
7.0.220.0060.00615.15
7.0.210.0000.01215.52
7.0.200.0150.01115.28
7.0.190.0200.00515.09
7.0.180.0170.01015.02
7.0.170.0150.00814.88
7.0.160.0150.01114.95
7.0.150.0220.00314.73
7.0.140.0150.01415.04
7.0.130.0210.00415.03
7.0.120.0140.00815.11
7.0.110.0170.01214.96
7.0.100.0230.00714.91
7.0.90.0150.00814.96
7.0.80.0170.01014.95
7.0.70.0150.01015.11
7.0.60.0500.00914.88
7.0.50.0170.00714.89
7.0.40.0200.00714.09
7.0.30.0240.00714.19
7.0.20.0190.00513.90
7.0.10.0180.00713.98
7.0.00.0220.00713.96
5.6.400.0030.00614.29
5.6.390.0030.01414.69
5.6.380.0030.00614.34
5.6.370.0060.00914.41
5.6.360.0040.00414.57
5.6.350.0030.01014.11
5.6.340.0040.00414.48
5.6.330.0000.01014.74
5.6.320.0090.00614.32
5.6.310.0030.00714.45
5.6.300.0100.00314.41
5.6.290.0040.01114.64
5.6.280.0070.00714.33
5.6.270.0070.00714.55
5.6.260.0070.00314.20
5.6.250.0070.00714.38
5.6.240.0120.00314.50
5.6.230.0100.00314.42
5.6.220.0030.01214.30
5.6.210.0030.01014.72
5.6.200.0060.00914.49
5.6.190.0030.00514.18
5.6.180.0060.00614.44
5.6.170.0030.01514.42
5.6.160.0090.00314.20
5.6.150.0080.00414.46
5.6.140.0000.01514.64
5.6.130.0070.00714.62
5.6.120.0030.00714.47
5.6.110.0120.00314.34
5.6.100.0070.00714.43
5.6.90.0070.00714.32
5.6.80.0090.00014.22
5.6.70.0000.01014.27
5.6.60.0030.01314.44
5.6.50.0040.00713.98
5.6.40.0060.00614.45
5.6.30.0070.00714.40
5.6.20.0000.00914.46
5.6.10.0070.00314.42
5.6.00.0040.00714.11

preferences:
33.45 ms | 400 KiB | 5 Q