3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class T { private $e; private $charset = "UTF-8"; public function output() { $e = $this->e; echo $e('hi'); } public setEscaper(Closure $close) { $this->e = $close->bindTo($this); } } $t = new T; $t->setEscaper(function($str) { return $this->charset; }); $t->output();
Output for 5.4.0 - 5.4.29
Parse error: syntax error, unexpected 'setEscaper' (T_STRING), expecting variable (T_VARIABLE) in /in/iS3p4 on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/iS3p4 on line 10
Process exited with code 255.