3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.21, 5.4.0 - 5.4.11
Fatal error: Cannot use $this as lexical variable in /in/59dTt on line 15
Process exited with code 255.

preferences:
168.2 ms | 1399 KiB | 41 Q