09/02/08 19:09:17
<?php
try {
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
fntest();
function fntest() {echo "call function";}
} catch (ErrorException $exception){
echo "何かエラーだよ<br />";
echo $exception->getMessage()."<br />";
echo "line:".$exception->getline();
exit();
}
?>
これを実行するとFatal error: Call to undefined function fntest() in~と出ます
定義を先にするかtry~catchをなくすとエラーは出ません
何がいけないんでしょうか