3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $a = 'foo'; public function print() { echo $a.PHP_EOL; } } $i = new $a; $i->$a = 'i'; $i->print(); (clone $i)->print();
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: a in /in/0OIBO on line 8 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/0OIBO:8 Stack trace: #0 {main} thrown in /in/0OIBO on line 8
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Parse error: syntax error, unexpected 'print' (T_PRINT), expecting identifier (T_STRING) in /in/0OIBO on line 5
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_PRINT, expecting T_STRING in /in/0OIBO on line 5
Process exited with code 255.