3v4l.org

run code in 300+ 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 git.master, git.master_jit, rfc.property-hooks
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:
69.87 ms | 401 KiB | 8 Q