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()); var_dump($pok->getNull()->get());
Output for git.master_jit, git.master
object(Pok)#2 (0) { } NULL object(Pok)#3 (0) { } NULL NULL NULL Fatal error: Uncaught Error: Call to a member function get() on null in /in/010be:23 Stack trace: #0 {main} thrown in /in/010be on line 23
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:
40.48 ms | 776 KiB | 4 Q