3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class FooNoMoreException extends Exception {} class Foo { protected $count = 500; public function step() { if (!$this->count) { throw new FooNoMoreException('No more steps to take.'); } $this->count--; } } $f = new Foo; try { while ($f->step()) {} } catch {} var_dump($f);
Output for 5.3.0 - 5.4.21
Parse error: syntax error, unexpected '{', expecting '(' in /in/tkvc6 on line 19
Process exited with code 255.