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();

preferences:
61.94 ms | 402 KiB | 5 Q