3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class XXX { function yo(){ echo 'yo!'; } } class Test { $class = 'XXX'; function __construct(){ $class = $this->class; $xxx = new $class(); $xxx->yo(); } } $test = new Test();
Output for 5.4.0 - 5.4.10
Parse error: syntax error, unexpected '$class' (T_VARIABLE), expecting function (T_FUNCTION) in /in/562sj on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.20
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/562sj on line 10
Process exited with code 255.