3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { private $p = 'secret'; function RetVal(){ return $this->p; } } class y { private $q = 'queen'; function RetValue() { return $this->q; } } $f = function() { return (new x)->RetVal(); }; echo $f(),"\n"; $g = function(){ return $this->p; }; $nu = $g->bindto((new x), "x"); echo $nu(),"\n"; echo $g->call((new x)); $ff = function() use(&$g) { return $g(); }; echo $ff->call((new y));
Output for git.master, git.master_jit, rfc.property-hooks
secret secret secret Fatal error: Uncaught Error: Using $this when not in object context in /in/3qVQ2:21 Stack trace: #0 /in/3qVQ2(28): {closure}() #1 [internal function]: y->{closure}() #2 /in/3qVQ2(30): Closure->call(Object(y)) #3 {main} thrown in /in/3qVQ2 on line 21
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:
55.65 ms | 401 KiB | 8 Q