3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Prototype { public function __call($method,$args) { $f = $this->$method; return $f(); } } $object = new Prototype; $object->monday = function(){ return "monday"; }; $object->hello_monday = function() use($this){ echo "what a beautiful ".$this->monday()." day!"; }; $object->{"hello_monday"}();
Output for 5.3.0 - 5.4.11
Fatal error: Cannot use $this as lexical variable in /in/59dTt on line 15
Process exited with code 255.