3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Duplication for completion... interface I1 {} interface I2 extends I1 { public function instanceOfSelf(self $object); public function instanceOfParent(parent $object); } class A implements I1 {} class B implements I2 { private function printBool(bool $b) { echo ($b ? 'true' : 'false') . "\n"; } public function instanceOfSelf(I2 $object) { $this->printBool($object instanceof I2); } public function instanceOfParent(I1 $object) { $this->printBool($object instanceof I1); } } $a = new A; $b = new B; $b->instanceOfSelf($b); // true $b->instanceOfParent($a); // true $b->instanceOfParent($b); // true
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Cannot use "parent" when current class scope has no parent in /in/tOSug on line 8
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:
115.97 ms | 405 KiB | 5 Q