3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $fruit = 'pear'; } function getfunc() { $b = function() { $a = function() { return 'apple'; }; echo $a(),"\n"; return $this->fruit; }; $x=$b->bindTo(new A()); return $x(); } echo getfunc();
Output for git.master, git.master_jit, rfc.property-hooks
apple Fatal error: Uncaught Error: Cannot access private property A::$fruit in /in/tEou3:11 Stack trace: #0 /in/tEou3(14): Closure->{closure}() #1 /in/tEou3(18): getfunc() #2 {main} thrown in /in/tEou3 on line 11
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:
59.19 ms | 401 KiB | 8 Q