3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Baz { private $BazEvent = 'BazEvent'; } class Bar{ private $event = 'BarEvent'; private $secendClass; /** * Constructor. */ public function __construct() { $this->secendClass = [ new Baz(), ]; } } class Foo { /** * @var string */ private $providerId; /** * @var array */ private $events; /** * Constructor. */ public function __construct($providerId) { $this->providerId = $providerId; $this->events = []; } /** * @return string */ public function getProviderId() { return $this->providerId; } /** * @return array */ public function getEvents() { return $this->events; } /** * @param EventsInterface $events * * @return $this */ public function addEvents(EventsInterface $events) { $this->events[] = $events; return $this; } } 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('crm_newsletter'); var_dump( entity2array($foo));

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.0110.00718.68
8.3.50.0180.00416.59
8.3.40.0080.00818.70
8.3.30.0090.00618.82
8.3.20.0000.00720.29
8.3.10.0040.00421.78
8.3.00.0050.00320.95
8.2.180.0130.00318.41
8.2.170.0030.01222.96
8.2.160.0000.01422.09
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0060.00322.25
8.2.120.0140.00026.35
8.2.110.0050.00522.26
8.2.100.0040.00718.03
8.2.90.0000.00817.91
8.2.80.0040.00417.97
8.2.70.0000.01017.75
8.2.60.0060.00317.93
8.2.50.0060.00318.16
8.2.40.0000.00822.32
8.2.30.0030.00719.41
8.2.20.0000.00818.17
8.2.10.0020.00518.12
8.2.00.0030.00518.11
8.1.280.0130.00325.92
8.1.270.0000.00822.20
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0090.00022.21
8.1.230.0040.00720.95
8.1.220.0000.00917.79
8.1.210.0060.00318.89
8.1.200.0140.00017.35
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0080.00018.47
8.1.160.0000.00719.01
8.1.150.0000.00820.72
8.1.140.0040.00419.61
8.1.130.0000.00718.89
8.1.120.0040.00417.36
8.1.110.0030.00617.38
8.1.100.0000.00717.46
8.1.90.0080.00017.38
8.1.80.0040.00417.46
8.1.70.0080.00017.34
8.1.60.0000.00917.59
8.1.50.0030.00517.40
8.1.40.0030.00617.40
8.1.30.0000.00817.63
8.1.20.0000.01017.64
8.1.10.0030.00517.59
8.1.00.0050.00317.49
8.0.300.0040.00419.86
8.0.290.0000.00716.75
8.0.280.0030.00318.44
8.0.270.0000.00717.26
8.0.260.0000.00716.74
8.0.250.0000.00716.92
8.0.240.0060.00316.93
8.0.230.0040.00416.90
8.0.220.0030.00316.90
8.0.210.0070.00016.91
8.0.200.0000.00716.92
8.0.190.0030.00616.85
8.0.180.0040.00416.88
8.0.170.0070.00016.93
8.0.160.0030.00316.88
8.0.150.0060.00316.84
8.0.140.0000.00716.74
8.0.130.0000.00513.40
8.0.120.0000.00816.85
8.0.110.0000.00816.81
8.0.100.0070.00016.84
8.0.90.0040.00416.95
8.0.80.0090.00616.88
8.0.70.0050.00216.84
8.0.60.0070.00016.73
8.0.50.0040.00416.85
8.0.30.0130.00817.12
8.0.20.0100.00817.40
8.0.10.0000.00716.90
8.0.00.0030.01616.89
7.4.330.0030.00315.55
7.4.320.0060.00016.49
7.4.300.0040.00416.56
7.4.290.0040.00416.67
7.4.280.0040.00416.50
7.4.270.0030.00316.52
7.4.260.0030.00313.34
7.4.250.0070.00016.47
7.4.240.0030.00316.50
7.4.230.0030.00316.32
7.4.220.0120.00816.48
7.4.210.0090.00516.63
7.4.200.0030.00316.60
7.4.160.0070.00916.51
7.4.150.0230.01717.40
7.4.140.0140.00817.86
7.4.130.0110.01516.71
7.4.120.0110.01016.49
7.4.110.0100.00716.45
7.4.100.0100.00716.48
7.4.90.0090.00916.77
7.4.80.0070.01019.39
7.4.70.0060.01016.64
7.4.60.0100.00616.59
7.4.50.0070.01016.64
7.4.40.0090.00816.44
7.4.30.0090.01216.58
7.4.00.0040.01114.86
7.3.330.0060.00013.23
7.3.320.0030.00313.15
7.3.310.0000.00716.36
7.3.300.0030.00316.37
7.3.290.0020.00516.21
7.3.280.0080.00816.33
7.3.270.0120.00917.40
7.3.260.0120.00616.53
7.3.250.0120.00816.47
7.3.240.0100.00716.66
7.3.230.0090.00916.39
7.3.210.0100.01016.31
7.3.200.0130.01016.31
7.3.190.0030.01316.25
7.3.180.0090.00616.33
7.3.170.0150.00016.38
7.3.160.0140.00716.72
7.3.120.0030.01514.80
7.3.110.0140.00214.76
7.3.100.0050.01114.66
7.3.90.0060.00614.92
7.3.80.0060.00914.54
7.3.70.0080.00414.87
7.3.60.0030.01014.85
7.3.50.0070.00614.87
7.3.40.0120.00214.90
7.3.30.0050.00914.78
7.3.20.0020.00916.72
7.3.10.0080.00716.50
7.3.00.0060.00616.50
7.2.330.0030.01416.75
7.2.320.0100.00716.78
7.2.310.0070.01016.81
7.2.300.0100.00616.82
7.2.290.0060.01116.76
7.2.250.0080.01014.83
7.2.240.0060.01115.10
7.2.230.0030.01015.06
7.2.220.0080.00715.13
7.2.210.0090.00515.13
7.2.200.0080.00514.97
7.2.190.0050.00914.93
7.2.180.0060.00614.73
7.2.170.0040.01214.93
7.2.130.0130.00316.76
7.2.120.0100.00716.81
7.2.110.0040.01116.77
7.2.100.0120.00616.69
7.2.90.0060.00916.72
7.2.80.0090.00616.68
7.2.70.0100.00716.76
7.2.60.0050.01416.85
7.2.50.0150.00316.81
7.2.40.0080.00616.80
7.2.30.0030.01316.99
7.2.20.0090.00916.63
7.2.10.0140.00316.93
7.2.00.0110.00618.16
7.1.330.0100.00515.83
7.1.320.0050.00815.78
7.1.310.0040.00915.84
7.1.300.0040.00415.64
7.1.290.0030.01015.59
7.1.280.0040.00615.84
7.1.270.0070.00715.65
7.1.260.0070.00315.76
7.1.250.0060.00915.71
7.1.240.0060.00915.74
7.1.230.0000.01615.33
7.1.220.0080.00315.27
7.1.210.0100.00615.14
7.1.200.0080.00615.87
7.1.190.0040.00815.29
7.1.180.0110.00315.91
7.1.170.0060.00915.57
7.1.160.0060.01215.77
7.1.150.0150.00415.71
7.1.140.0060.00615.65
7.1.130.0040.01615.50
7.1.120.0170.00315.75
7.1.110.0110.00415.90
7.1.100.0070.00816.88
7.1.90.0090.00915.52
7.1.80.0130.00615.61
7.1.70.0090.00616.29
7.1.60.0230.01124.53
7.1.50.0260.00824.31
7.1.40.0250.01024.30
7.1.30.0250.00924.16
7.1.20.0250.01124.23
7.1.10.0170.00715.29
7.1.00.0140.01015.40
7.0.330.0110.00714.97
7.0.320.0140.00315.23
7.0.310.0000.01614.90
7.0.300.0110.00715.54
7.0.290.0150.00015.19
7.0.280.0130.00315.52
7.0.270.0150.01115.34
7.0.260.0150.00715.40
7.0.250.0100.01015.14
7.0.240.0140.01015.26
7.0.230.0120.01215.46
7.0.220.0140.01515.67
7.0.210.0160.01015.15
7.0.200.0220.00715.05
7.0.190.0200.00715.16
7.0.180.0220.01415.01
7.0.170.0210.00614.94
7.0.160.0270.00314.84
7.0.150.0200.00915.01
7.0.140.0150.01014.93
7.0.130.0220.00314.91
7.0.120.0150.01015.08
7.0.110.0200.00814.89
7.0.100.0150.01114.83
7.0.90.0160.00914.87
7.0.80.0150.00815.03
7.0.70.0170.00714.74
7.0.60.0170.00814.85
7.0.50.0160.00814.95
7.0.40.0150.01214.00
7.0.30.0190.00513.90
7.0.20.0170.00813.99
7.0.10.0100.01113.86
7.0.00.0190.00514.07
5.6.380.0000.01514.51

preferences:
43.37 ms | 400 KiB | 5 Q