3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** @implements IteratorAggregate<DateTimeInterface> */ class MyDatePeriod extends DatePeriod implements IteratorAggregate { public function getIterator(): self { return $this; } } function getDatePeriod(string $period): DatePeriod { return new MyDatePeriod($period); } $datePeriod = getDatePeriod("R4/2012-07-01T00:00:00Z/P7D"); if ($datePeriod instanceof IteratorAggregate) { $datePeriod->getIterator(); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Declaration of MyDatePeriod::getIterator(): MyDatePeriod must be compatible with DatePeriod::getIterator(): Iterator in /in/Pf4Nb on line 6
Process exited with code 255.

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:
127.44 ms | 405 KiB | 5 Q