A self-defined exception


code}]: {$this->message}\n"; } public function customFunction() { echo "A Custom function for this type of exception\n"; } } for($a=0;$a<40;$a++){ echo $a.", " ; try { if ($a == 32) { throw new MyException ('A terrible error has occured', 42); } } catch (Exception $e) { echo 'Exception ' . $e->getCode() . ':' . $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . '
'; echo 'Exception ' . $e->__toString().'
'; } } ?>