発生した最後のエラーを返します:
<?php
echo $test;
print_r(error_get_last());
?>
上のコードの出力は、次の通り:
Array
(
[type] => 8
[message] => Undefined variable: test
[file] => C:\webfolder\test.php
[line] => 2
)
error_get_last() 関数は、発生した最後のエラーを返します(連想配列で)。
連想配列には、次の4つのキーがあります:
error_get_last();
技術内容/h2>
返り値: | 最後に発生したエラーについての情報を連想配列で返します。連想配列のキーは "type"、"message"、"file" および "line" です。 |
---|---|
PHP バージョン: | 5.2+ |