3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Outside { private $private = 'You should be able to see me'; public function getAnon() { return new class($this) { private $outside; public function __construct($outside) { $this->outside = $outside; } public function getPrivateOfOutside() { return $this->outside->private; } }; } } $foo = new Outside(); var_dump($foo->getAnon()->getPrivateOfOutside());
Output for rfc.property-hooks, git.master, git.master_jit
Fatal error: Uncaught Error: Cannot access private property Outside::$private in /in/QLFoJ:12 Stack trace: #0 /in/QLFoJ(18): class@anonymous->getPrivateOfOutside() #1 {main} thrown in /in/QLFoJ on line 12
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:
94.4 ms | 2713 KiB | 4 Q