3v4l.org

run code in 300+ PHP versions simultaneously
<?php $c = new \ReflectionClass(\DateTimeImmutable::class); $methods = array_map(function ($m) { return $m->getName() . '(' . implode(',', array_map(function ($p) { return $p->getType() . ' $' . $p->getName() . ($p->isOptional() ? ' = ' . var_export($p->getDefaultValue(), true) : ''); }, $m->getParameters())) . ')' . ($m->getReturnType() ? (': ' . $m->getReturnType()) : ''); }, $c->getMethods()); $properties = array_map(function ($m) { return $m->getName(); }, $c->getProperties()); var_dump($methods, $properties);
Output for git.master_jit, git.master
array(23) { [0]=> string(68) "__construct(string $datetime = 'now',?DateTimeZone $timezone = NULL)" [1]=> string(20) "__serialize(): array" [2]=> string(32) "__unserialize(array $data): void" [3]=> string(10) "__wakeup()" [4]=> string(25) "__set_state(array $array)" [5]=> string(80) "createFromFormat(string $format,string $datetime,?DateTimeZone $timezone = NULL)" [6]=> string(41) "createFromTimestamp(int|float $timestamp)" [7]=> string(15) "getLastErrors()" [8]=> string(22) "format(string $format)" [9]=> string(13) "getTimezone()" [10]=> string(11) "getOffset()" [11]=> string(14) "getTimestamp()" [12]=> string(60) "diff(DateTimeInterface $targetObject,bool $absolute = false)" [13]=> string(24) "modify(string $modifier)" [14]=> string(27) "add(DateInterval $interval)" [15]=> string(27) "sub(DateInterval $interval)" [16]=> string(35) "setTimezone(DateTimeZone $timezone)" [17]=> string(67) "setTime(int $hour,int $minute,int $second = 0,int $microsecond = 0)" [18]=> string(38) "setDate(int $year,int $month,int $day)" [19]=> string(50) "setISODate(int $year,int $week,int $dayOfWeek = 1)" [20]=> string(28) "setTimestamp(int $timestamp)" [21]=> string(35) "createFromMutable(DateTime $object)" [22]=> string(65) "createFromInterface(DateTimeInterface $object): DateTimeImmutable" } array(0) { }
Output for rfc.property-hooks
array(22) { [0]=> string(68) "__construct(string $datetime = 'now',?DateTimeZone $timezone = NULL)" [1]=> string(20) "__serialize(): array" [2]=> string(32) "__unserialize(array $data): void" [3]=> string(10) "__wakeup()" [4]=> string(25) "__set_state(array $array)" [5]=> string(80) "createFromFormat(string $format,string $datetime,?DateTimeZone $timezone = NULL)" [6]=> string(15) "getLastErrors()" [7]=> string(22) "format(string $format)" [8]=> string(13) "getTimezone()" [9]=> string(11) "getOffset()" [10]=> string(14) "getTimestamp()" [11]=> string(60) "diff(DateTimeInterface $targetObject,bool $absolute = false)" [12]=> string(24) "modify(string $modifier)" [13]=> string(27) "add(DateInterval $interval)" [14]=> string(27) "sub(DateInterval $interval)" [15]=> string(35) "setTimezone(DateTimeZone $timezone)" [16]=> string(67) "setTime(int $hour,int $minute,int $second = 0,int $microsecond = 0)" [17]=> string(38) "setDate(int $year,int $month,int $day)" [18]=> string(50) "setISODate(int $year,int $week,int $dayOfWeek = 1)" [19]=> string(28) "setTimestamp(int $timestamp)" [20]=> string(35) "createFromMutable(DateTime $object)" [21]=> string(65) "createFromInterface(DateTimeInterface $object): DateTimeImmutable" } array(0) { }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.32 ms | 412 KiB | 5 Q