3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Source: https://bugs.php.net/bug.php?id=63305 new Attachment(''); function __autoload($class) { switch ($class) { case "Attachment": eval('class Attachment extends File {}'); break; case "File": eval('class File { use TDatabaseObject { TDatabaseObject::__construct as private databaseObjectConstruct; } public function __construct() {} }'); break; case "TDatabaseObject": eval('trait TDatabaseObject { public function __construct() {}}'); break; } return TRUE; }
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /in/ZphOa(14) : eval()'d code on line 1 Fatal error: Class 'File' not found in /in/ZphOa(11) : eval()'d code on line 1
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_USE, expecting T_FUNCTION in /in/ZphOa(14) : eval()'d code on line 1 Fatal error: Class 'File' not found in /in/ZphOa(11) : eval()'d code on line 1
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: attachment in /in/ZphOa on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: attachment in /in/ZphOa on line 4