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 getTest() { return $this->test; } public function getTest2() { return $this->test2; } 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($recursionDepth = 2) { $entity = $this; $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.0080.01116.75
8.3.50.0070.01416.30
8.3.40.0110.00718.70
8.3.30.0040.01118.80
8.3.20.0000.00720.35
8.3.10.0080.00021.85
8.3.00.0080.00020.84
8.2.180.0150.00618.54
8.2.170.0040.01122.96
8.2.160.0120.00622.20
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00020.34
8.2.120.0030.00526.35
8.2.110.0090.00020.52
8.2.100.0090.00319.45
8.2.90.0050.00319.17
8.2.80.0000.00817.97
8.2.70.0030.00617.75
8.2.60.0050.00517.80
8.2.50.0030.00618.10
8.2.40.0000.00820.38
8.2.30.0040.00421.09
8.2.20.0070.00018.01
8.2.10.0000.00718.01
8.2.00.0050.00318.04
8.1.280.0040.01125.92
8.1.270.0060.00323.91
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0090.00020.36
8.1.230.0060.00622.21
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0080.00017.25
8.1.180.0030.00618.10
8.1.170.0000.00918.50
8.1.160.0070.00018.89
8.1.150.0040.00420.66
8.1.140.0040.00419.46
8.1.130.0000.00818.81
8.1.120.0040.00417.37
8.1.110.0030.00617.45
8.1.100.0060.00317.36
8.1.90.0080.00017.52
8.1.80.0000.00817.35
8.1.70.0080.00017.45
8.1.60.0040.00417.58
8.1.50.0070.00017.55
8.1.40.0060.00317.38
8.1.30.0030.00617.71
8.1.20.0000.00717.56
8.1.10.0040.00417.52
8.1.00.0000.00917.55
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0000.00718.33
8.0.270.0040.00417.19
8.0.260.0070.00016.87
8.0.250.0030.00317.00
8.0.240.0040.00416.95
8.0.230.0040.00416.96
8.0.220.0000.00716.81
8.0.210.0000.00716.77
8.0.200.0000.00716.99
8.0.190.0060.00316.94
8.0.180.0070.00016.88
8.0.170.0040.00416.94
8.0.160.0030.00316.89
8.0.150.0030.00516.88
8.0.140.0030.00516.89
8.0.130.0030.00313.29
8.0.120.0000.00716.88
8.0.110.0040.00416.91
8.0.100.0000.00716.95
8.0.90.0020.00516.81
8.0.80.0060.00916.91
8.0.70.0040.00416.73
8.0.60.0000.00816.73
8.0.50.0050.00316.93
8.0.30.0130.00517.21
8.0.20.0110.00817.40
8.0.10.0000.00716.96
8.0.00.0130.00316.70
7.4.330.0000.00515.55
7.4.320.0060.00016.63
7.4.300.0030.00316.62
7.4.290.0040.00416.60
7.4.280.0080.00016.54
7.4.270.0000.00716.57
7.4.260.0030.00313.28
7.4.250.0090.00016.57
7.4.240.0000.00816.60
7.4.230.0000.00716.47
7.4.220.0100.01616.61
7.4.210.0060.01116.57
7.4.200.0070.00016.39
7.4.160.0060.01016.53
7.4.150.0150.00317.40
7.4.140.0090.01017.86
7.4.130.0170.00316.55
7.4.120.0080.01016.53
7.4.110.0090.00916.80
7.4.100.0120.00616.43
7.4.90.0060.01216.36
7.4.80.0090.01419.39
7.4.70.0070.01016.45
7.4.60.0150.00316.45
7.4.50.0060.00916.41
7.4.40.0140.00316.52
7.4.30.0160.00616.50
7.4.10.0070.01115.08
7.4.00.0080.01014.96
7.3.330.0060.00013.32
7.3.320.0000.00513.19
7.3.310.0070.00016.32
7.3.300.0000.00716.34
7.3.290.0000.00716.31
7.3.280.0080.00816.35
7.3.270.0110.01117.40
7.3.260.0110.00716.53
7.3.250.0110.01016.50
7.3.240.0080.01116.47
7.3.230.0110.00616.55
7.3.210.0090.00916.33
7.3.200.0080.00816.41
7.3.190.0030.01416.63
7.3.180.0100.00616.46
7.3.170.0100.00616.38
7.3.160.0030.01216.54
7.3.130.0070.01114.95
7.3.120.0090.00914.58
7.3.110.0100.01015.09
7.3.100.0030.01214.72
7.3.90.0070.00714.73
7.3.80.0080.00414.57
7.3.70.0030.00714.91
7.3.60.0070.00714.78
7.3.50.0030.01214.87
7.3.40.0060.00614.86
7.3.30.0050.00514.57
7.3.20.0070.01016.67
7.3.10.0110.00416.43
7.3.00.0060.00916.49
7.2.330.0090.00916.64
7.2.320.0080.01416.78
7.2.310.0030.01316.79
7.2.300.0120.00616.92
7.2.290.0000.02016.51
7.2.260.0070.01015.28
7.2.250.0070.01114.86
7.2.240.0000.01715.10
7.2.230.0070.00715.24
7.2.220.0030.01015.08
7.2.210.0000.01115.20
7.2.200.0040.01115.02
7.2.190.0070.00715.21
7.2.180.0000.01315.09
7.2.170.0060.00315.02
7.2.160.0030.01415.01
7.2.150.0040.01617.00
7.2.140.0070.01116.68
7.2.130.0070.00916.84
7.2.120.0060.01016.82
7.2.110.0090.00716.96
7.2.100.0070.01016.86
7.2.90.0040.01416.97
7.2.80.0130.00716.66
7.2.70.0110.00716.79
7.2.60.0100.00916.73
7.2.50.0110.00616.85
7.2.40.0100.00616.97
7.2.30.0090.00416.94
7.2.20.0100.01016.75
7.2.10.0100.00716.81
7.2.00.0070.00917.50
7.1.330.0000.01215.92
7.1.320.0060.01015.72
7.1.310.0080.00415.81
7.1.300.0040.00415.85
7.1.290.0060.00615.80
7.1.280.0100.00615.61
7.1.270.0100.00315.65
7.1.260.0070.01015.46
7.1.250.0040.01015.65
7.1.240.0100.00615.87
7.1.230.0100.00715.88
7.1.220.0030.01015.55
7.1.210.0070.00715.81
7.1.200.0120.00815.54
7.1.190.0100.00715.86
7.1.180.0030.00916.02
7.1.170.0000.00815.60
7.1.160.0070.00716.02
7.1.150.0070.00315.82
7.1.140.0030.01015.80
7.1.130.0090.00616.02
7.1.120.0070.00715.56
7.1.110.0070.00715.94
7.1.100.0030.00717.08
7.1.90.0040.01415.95
7.1.80.0070.01115.84
7.1.70.0000.01316.47
7.1.60.0220.01324.66
7.1.50.0300.00724.44
7.1.40.0220.01224.13
7.1.30.0230.01324.21
7.1.20.0260.01024.36
7.1.10.0160.01115.30
7.1.00.0180.00815.47
7.0.330.0030.01015.47
7.0.320.0070.00715.62
7.0.310.0100.00315.52
7.0.300.0040.00815.35
7.0.290.0000.01015.46
7.0.280.0090.00615.18
7.0.270.0070.00715.17
7.0.260.0060.00615.48
7.0.250.0090.00615.55
7.0.240.0070.00715.27
7.0.230.0040.01115.61
7.0.220.0070.01015.55
7.0.210.0000.01215.39
7.0.200.0160.00915.36
7.0.190.0150.01015.25
7.0.180.0180.00814.93
7.0.170.0200.00714.98
7.0.160.0160.00614.99
7.0.150.0190.00714.98
7.0.140.0180.00815.13
7.0.130.0150.00815.10
7.0.120.0180.00515.19
7.0.110.0160.00814.90
7.0.100.0160.01114.92
7.0.90.0180.00714.99
7.0.80.0150.01114.98
7.0.70.0130.01314.91
7.0.60.0200.00814.68
7.0.50.0210.00315.12
7.0.40.0190.00514.24
7.0.30.0180.00814.11
7.0.20.0180.00713.93
7.0.10.0440.00714.11
7.0.00.0180.00714.08
5.6.400.0090.00914.36
5.6.390.0060.01014.41
5.6.380.0000.01414.51
5.6.370.0110.00414.84
5.6.360.0060.00314.13
5.6.350.0090.00614.27
5.6.340.0080.00814.64
5.6.330.0080.00314.32
5.6.320.0040.01214.59
5.6.310.0070.00714.75
5.6.300.0090.00314.59
5.6.290.0060.00614.46
5.6.280.0070.01114.47
5.6.270.0100.00314.59
5.6.260.0100.00314.53
5.6.250.0040.01114.85
5.6.240.0100.00714.43
5.6.230.0030.01114.63
5.6.220.0150.00014.27
5.6.210.0070.00714.36
5.6.200.0070.00314.43
5.6.190.0000.01514.52
5.6.180.0110.00414.54
5.6.170.0100.00314.33
5.6.160.0000.01614.37
5.6.150.0070.00714.55
5.6.140.0080.00514.44
5.6.130.0110.00414.49
5.6.120.0030.01414.57
5.6.110.0030.01014.37
5.6.100.0060.01014.41
5.6.90.0060.01014.21
5.6.80.0120.00614.29
5.6.70.0090.00914.35
5.6.60.0000.01214.42
5.6.50.0100.00314.34
5.6.40.0090.00614.45
5.6.30.0030.01014.29
5.6.20.0030.01414.50
5.6.10.0030.00614.43
5.6.00.0110.00414.55

preferences:
60.23 ms | 400 KiB | 5 Q