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($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.0100.00716.88
8.3.50.0150.00016.49
8.3.40.0110.00718.65
8.3.30.0090.00618.82
8.3.20.0040.00420.09
8.3.10.0040.00421.75
8.3.00.0040.00420.77
8.2.180.0140.00718.41
8.2.170.0160.00318.85
8.2.160.0080.00622.96
8.2.150.0000.00725.66
8.2.140.0060.00324.66
8.2.130.0000.00722.06
8.2.120.0000.00826.35
8.2.110.0100.00020.35
8.2.100.0000.01117.72
8.2.90.0040.00419.21
8.2.80.0030.00518.05
8.2.70.0000.00817.50
8.2.60.0030.00618.03
8.2.50.0090.00018.10
8.2.40.0040.00422.20
8.2.30.0030.00520.96
8.2.20.0040.00418.10
8.2.10.0000.00718.27
8.2.00.0000.00718.11
8.1.280.0060.00925.92
8.1.270.0080.00023.84
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00620.81
8.1.230.0070.00419.00
8.1.220.0070.00417.79
8.1.210.0040.00418.77
8.1.200.0030.00617.38
8.1.190.0000.00817.47
8.1.180.0040.00418.10
8.1.170.0000.00818.66
8.1.160.0040.00419.05
8.1.150.0080.00020.63
8.1.140.0050.00219.48
8.1.130.0030.00318.83
8.1.120.0040.00417.34
8.1.110.0070.00017.47
8.1.100.0040.00417.40
8.1.90.0040.00417.47
8.1.80.0000.00817.39
8.1.70.0040.00417.54
8.1.60.0000.00817.56
8.1.50.0030.00517.52
8.1.40.0040.00417.55
8.1.30.0040.00417.58
8.1.20.0050.00217.68
8.1.10.0080.00017.48
8.1.00.0000.00717.59
8.0.300.0000.00718.77
8.0.290.0020.00516.75
8.0.280.0070.00018.53
8.0.270.0070.00017.35
8.0.260.0070.00016.85
8.0.250.0030.00316.90
8.0.240.0080.00016.84
8.0.230.0030.00516.97
8.0.220.0030.00316.84
8.0.210.0070.00016.80
8.0.200.0030.00317.05
8.0.190.0070.00317.02
8.0.180.0000.00716.96
8.0.170.0080.00016.99
8.0.160.0060.00316.81
8.0.150.0000.00716.84
8.0.140.0040.00416.85
8.0.130.0030.00313.41
8.0.120.0070.00016.94
8.0.110.0040.00416.81
8.0.100.0020.00516.94
8.0.90.0030.00516.76
8.0.80.0080.01116.91
8.0.70.0040.00416.77
8.0.60.0050.00216.99
8.0.50.0070.00016.72
8.0.30.0110.00917.17
8.0.20.0100.00917.41
8.0.10.0070.00017.11
8.0.00.0160.00016.74
7.4.330.0000.00515.55
7.4.320.0030.00316.43
7.4.300.0060.00016.61
7.4.290.0000.00816.43
7.4.280.0020.00516.53
7.4.270.0000.00816.55
7.4.260.0000.00713.25
7.4.250.0070.00016.51
7.4.240.0030.00416.64
7.4.230.0030.00516.71
7.4.220.0120.00716.69
7.4.210.0090.00916.61
7.4.200.0030.00316.35
7.4.160.0110.00816.46
7.4.150.0090.00917.40
7.4.140.0130.00717.86
7.4.130.0060.01216.63
7.4.120.0130.00816.52
7.4.110.0060.01116.53
7.4.100.0080.01116.38
7.4.90.0100.00716.43
7.4.80.0110.00519.39
7.4.70.0060.01016.50
7.4.60.0060.01016.54
7.4.50.0100.00716.42
7.4.40.0160.00316.27
7.4.30.0040.01716.42
7.4.00.0060.01015.18
7.3.330.0030.00313.36
7.3.320.0060.00013.37
7.3.310.0070.00016.32
7.3.300.0000.00716.43
7.3.290.0060.00016.23
7.3.280.0110.00616.37
7.3.270.0120.00917.40
7.3.260.0090.01216.38
7.3.250.0110.01016.40
7.3.240.0110.00816.41
7.3.230.0070.01016.34
7.3.210.0140.00716.45
7.3.200.0070.01116.54
7.3.190.0040.01216.57
7.3.180.0100.00616.39
7.3.170.0060.01116.52
7.3.160.0000.01616.64
7.2.330.0070.01016.53
7.2.320.0070.01416.77
7.2.310.0060.01016.76
7.2.300.0090.01316.52
7.2.290.0060.01616.75
7.2.60.0080.00417.08
7.2.00.0030.01019.47
7.1.200.0360.00315.35
7.1.100.0030.01017.99
7.1.70.0080.00417.07
7.1.60.0330.01033.04
7.1.50.0370.00733.12
7.1.40.0370.00732.41
7.1.30.0370.01032.64
7.1.20.0470.00332.70
7.1.10.0200.01014.85
7.1.00.0870.01315.10
7.0.200.0170.01015.16
7.0.190.0270.01015.14
7.0.180.0200.01014.28
7.0.170.0230.00714.54
7.0.160.0270.00714.59
7.0.150.0170.01314.55
7.0.140.0270.00714.47
7.0.130.0230.01014.68
7.0.120.0270.01014.79
7.0.110.0230.00714.44
7.0.100.0230.01314.44
7.0.90.0300.01314.46
7.0.80.0200.01014.64
7.0.70.0230.01014.77
7.0.60.0300.00314.51
7.0.50.0270.00714.50
7.0.40.0270.00714.62
7.0.30.0200.01014.73
7.0.20.0200.01014.63
7.0.10.0330.01314.61
7.0.00.0270.00314.64

preferences:
49.04 ms | 401 KiB | 5 Q