3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class testClass{ protected $a; function __construct($a) { $this->a = $a; } public function toString() { echo $this->a; } } $b = new $testClass(10); $b->toString();
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: testClass in /in/dtEpM on line 13 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/dtEpM:13 Stack trace: #0 {main} thrown in /in/dtEpM on line 13
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Notice: Undefined variable: testClass in /in/dtEpM on line 13 Fatal error: Class name must be a valid object or a string in /in/dtEpM on line 13
Process exited with code 255.