3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyParent { private $var = 0; } class Child extends MyParent { public function __construct() { $this->var = 1; } } class Abuser extends MyParent { public function get(MyParent $child) { return $child->var; } } $chils = new Child(); $abuser = new Abuser(); var_dump($abuser->get($child));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Child::$var is deprecated in /in/4imK6 on line 12 Warning: Undefined variable $child in /in/4imK6 on line 27 Fatal error: Uncaught TypeError: Abuser::get(): Argument #1 ($child) must be of type MyParent, null given, called in /in/4imK6 on line 27 and defined in /in/4imK6:18 Stack trace: #0 /in/4imK6(27): Abuser->get(NULL) #1 {main} thrown in /in/4imK6 on line 18
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:
49.65 ms | 401 KiB | 8 Q