3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Pok { public function get(): Pok|null { return new Pok(); } public function getNull(): Pok|null { return null; } } $pok = new Pok(); var_dump($pok->get()); var_dump($pok->getNull()); var_dump($pok->get()?->get()); var_dump($pok->getNull()?->get()); var_dump($pok->getNull()?->getNull()?->get()); var_dump($pok->getNull()?->getNull()->get());
Output for git.master, git.master_jit
object(Pok)#2 (0) { } NULL object(Pok)#3 (0) { } NULL NULL NULL

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:
47.2 ms | 765 KiB | 4 Q