3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php (new class { private $state; public function __construct() { $this->state = 0; } public function add($number) { $this->state += $number; return $this; } public function mult($number) { $this->state =* $number; return $this; } public function echo() { echo $this->state; return $this; } })->add(3)->add(7)->mult(3)->echo();
Output for 7.0.0
Parse error: syntax error, unexpected '*' in /in/7rTem on line 19
Process exited with code 255.
Output for 5.4.10 - 5.6.16
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/7rTem on line 3
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/7rTem on line 3
Process exited with code 255.