3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $privateProperty; public function setPrivateProperty($prop) { $this->privateProperty = $prop; return $this; } public function evaluate(MyClass1 $object) { // this does not work var_dump($object->privateProperty); } } class MyClass1 { private $privateProperty; public function setPrivateProperty($prop) { $this->privateProperty = $prop; return $this; } } $obj1 = (new MyClass)->setPrivateProperty('foo'); $obj2 = (new MyClass1)->setPrivateProperty('bar'); $obj1->evaluate($obj2);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Cannot access private property MyClass1::$privateProperty in /in/J1GjG:15 Stack trace: #0 /in/J1GjG(34): MyClass->evaluate(Object(MyClass1)) #1 {main} thrown in /in/J1GjG 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.74 ms | 401 KiB | 8 Q