3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Sample { private string $instantiatedViaConstructor; private ?string $notInstantiated; public function __construct(string $instantiatedViaConstructor) { $this->instantiatedViaConstructor = $instantiatedViaConstructor; } public function getNotInstantiated(): ?string { return $this->notInstantiated; } public function getWorkingNotInstantiated(): ?string { return $this->notInstantiated ?? null; } } var_dump((new Sample('foo'))->getWorkingNotInstantiated()); var_dump((new Sample('foo'))->getNotInstantiated());
Output for rfc.property-hooks, git.master, git.master_jit
NULL Fatal error: Uncaught Error: Typed property Sample::$notInstantiated must not be accessed before initialization in /in/GO48X:15 Stack trace: #0 /in/GO48X(26): Sample->getNotInstantiated() #1 {main} thrown in /in/GO48X on line 15
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:
56.27 ms | 1516 KiB | 4 Q