3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ReminderPushEvents { /** * @var array */ private $properties; /** * @var string */ private $event = 'reminder_push_event'; /** * @var \DateTimeInterface */ private $timestamp; /** * Constructor. */ public function __construct() { $this->properties = ['customers' => []]; } /** * [ * 'customers' => [ * ['customerId' => 1213], * ['customerId' => 1212] * ] * ] * * @param array $properties * * @return $this */ public function addProperties(array $properties) { $this->properties['customers'] = $properties; return $this; } /** * @return array */ public function getProperties() { if (!$this->properties) { throw new \RuntimeException(); } return $this->properties; } /** * @return string */ public function getEvent() { if (!$this->event) { throw new \RuntimeException(); } return $this->event; } /** * @return \DateTimeInterface */ public function getTimestamp() { if (!$this->timestamp) { return new \DateTimeImmutable(); } return $this->timestamp; } } class EventRequest { /** * @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( $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'); $event = new ReminderPushEvents(); $event->addProperties( [['customerId' => 1213], ['customerId' => 1212]]); $foo->addEvents($event); 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.0130.00918.68
8.3.50.0090.00616.26
8.3.40.0090.00618.78
8.3.30.0090.00618.60
8.3.20.0000.00720.34
8.3.10.0080.00021.77
8.3.00.0050.00320.84
8.2.180.0180.00418.66
8.2.170.0120.00322.96
8.2.160.0110.00422.25
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00422.26
8.2.120.0060.00326.35
8.2.110.0030.00620.56
8.2.100.0090.00317.72
8.2.90.0040.00419.05
8.2.80.0050.00317.97
8.2.70.0030.01017.25
8.2.60.0040.00417.91
8.2.50.0090.00018.10
8.2.40.0040.00422.19
8.2.30.0030.00719.23
8.2.20.0000.00817.94
8.2.10.0000.00817.89
8.2.00.0000.00818.08
8.1.280.0110.00425.92
8.1.270.0000.00722.04
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00422.56
8.1.230.0110.00019.14
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0060.00317.23
8.1.190.0060.00317.23
8.1.180.0080.00018.10
8.1.170.0060.00318.52
8.1.160.0070.00019.07
8.1.150.0050.00320.56
8.1.140.0070.00019.39
8.1.130.0000.00718.72
8.1.120.0080.00017.42
8.1.110.0040.00417.30
8.1.100.0000.00817.36
8.1.90.0040.00417.37
8.1.80.0040.00417.35
8.1.70.0070.00017.26
8.1.60.0000.00917.41
8.1.50.0050.00317.49
8.1.40.0030.00517.51
8.1.30.0040.00417.57
8.1.20.0060.00617.55
8.1.10.0040.00417.56
8.1.00.0030.00517.46
8.0.300.0080.00018.77
8.0.290.0080.00016.61
8.0.280.0030.00318.29
8.0.270.0030.00317.14
8.0.260.0030.00316.87
8.0.250.0000.00717.04
8.0.240.0050.00316.91
8.0.230.0070.00016.88
8.0.220.0070.00016.91
8.0.210.0070.00016.93
8.0.200.0000.00616.89
8.0.190.0080.00017.01
8.0.180.0000.00716.94
8.0.170.0050.00216.82
8.0.160.0040.00416.88
8.0.150.0000.00716.79
8.0.140.0000.00716.77
8.0.130.0030.00313.39
8.0.120.0030.00516.92
8.0.110.0070.00016.74
8.0.100.0040.00416.94
8.0.90.0040.00416.96
8.0.80.0100.01316.84
8.0.70.0050.00316.93
8.0.60.0030.00516.89
8.0.50.0050.00216.81
8.0.30.0090.01017.11
8.0.20.0110.00917.40
8.0.10.0040.00417.03
8.0.00.0060.01216.95
7.4.330.0000.00515.55
7.4.320.0000.00616.46
7.4.300.0030.00316.38
7.4.290.0030.00416.56
7.4.280.0040.00416.42
7.4.270.0030.00316.48
7.4.260.0070.00013.23
7.4.250.0030.00316.42
7.4.240.0070.00016.46
7.4.230.0040.00416.66
7.4.220.0070.01116.39
7.4.210.0080.00916.49
7.4.200.0030.00316.55
7.4.160.0150.00416.51
7.4.150.0090.01217.40
7.4.140.0080.01317.86
7.4.130.0060.01916.50
7.4.120.0080.01316.51
7.4.110.0070.01116.32
7.4.100.0150.00616.54
7.4.90.0160.00616.60
7.4.80.0060.01019.39
7.4.70.0120.00716.50
7.4.60.0060.00916.52
7.4.50.0100.00716.32
7.4.40.0040.01216.47
7.4.30.0060.01216.57
7.4.00.0120.00614.81
7.3.330.0000.00513.28
7.3.320.0030.00313.38
7.3.310.0060.00316.19
7.3.300.0000.00616.29
7.3.290.0050.00316.38
7.3.280.0090.00916.30
7.3.270.0000.01617.40
7.3.260.0140.00516.45
7.3.250.0170.00516.42
7.3.240.0110.00616.34
7.3.230.0030.01316.31
7.3.210.0030.01416.38
7.3.200.0070.01116.39
7.3.190.0030.01216.27
7.3.180.0040.01216.66
7.3.170.0100.01016.35
7.3.160.0000.01716.35
7.2.330.0100.00716.51
7.2.320.0060.01216.35
7.2.310.0120.00316.70
7.2.300.0120.00516.62
7.2.290.0120.00616.24
7.2.80.0140.00716.28
7.2.60.0070.00716.77
7.2.00.0000.01519.45
7.1.200.0060.00315.44
7.1.100.0070.00717.99
7.1.70.0030.00516.90
7.1.60.0770.00332.96
7.1.50.0730.01032.94
7.1.40.0630.01732.51
7.1.30.0870.00332.45
7.1.20.0670.02332.91
7.1.10.0570.01014.66
7.1.00.0930.01014.77
7.0.200.0530.01014.97
7.0.190.0570.00714.77
7.0.180.0600.01014.33
7.0.170.0630.00714.36
7.0.160.0530.01714.43
7.0.150.0530.00714.32
7.0.140.0600.01014.60
7.0.130.0600.00714.78
7.0.120.0500.01314.82
7.0.110.0500.01014.36
7.0.100.0570.01314.50
7.0.90.0670.01014.27
7.0.80.0570.01014.46
7.0.70.0770.00714.50
7.0.60.0700.01314.13
7.0.50.0570.00314.30
7.0.40.0770.01014.48
7.0.30.0600.00714.32
7.0.20.0530.01014.53
7.0.10.0530.01314.45
7.0.00.0500.01014.55

preferences:
53.3 ms | 401 KiB | 5 Q