3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function tryInclude() { try { require $this->getFileName('include'); } catch (Exception $e) { echo "Catched"; } } private function getFileName($action) { $file = '/unknown/path/to/file'; if (false === file_exists($file)) { throw new Exception(sprintf('The file for this %s was not found.', $action); } else { return $file; } } } $instance = new Foo; $instance->tryInclude();
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Parse error: syntax error, unexpected ';' in /in/fkhFY on line 19
Process exited with code 255.

preferences:
179.97 ms | 1395 KiB | 53 Q