3v4l.org

run code in 300+ PHP versions simultaneously
<?php final readonly class TestObject { public function __construct(public int $number) { echo "Constructor called\n"; } public function getLucky(): void { echo "Your lucky number: $this->number\n"; } } $lazy = new ReflectionClass(TestObject::class)->newLazyGhost(function (TestObject $object) { $object->__construct(42); }); echo "Object created\n"; $lazy->getLucky();
Output for git.master_jit, git.master
Object created Constructor called Your lucky number: 42

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:
134.77 ms | 997 KiB | 7 Q