3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = new class { public $a; public $b = null; public $c = ""; public function set($name) { $this->a[$name] = $name; $this->b[$name] = $name; $this->c[$name] = $name; } public function exec() { var_dump($this->a); var_dump($this->b); var_dump($this->c); } }; $test->write([1,2,3]); $test->exec(); $test->write("test"); $test->exec(); $test->write(123456); $test->exec();
based on a4T3V
Output for 7.0.0 - 7.3.0alpha1
Fatal error: Uncaught Error: Call to undefined method class@anonymous::write() in /in/iej6r:22 Stack trace: #0 {main} thrown in /in/iej6r on line 22
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/iej6r on line 2
Process exited with code 255.