PHP error_get_last()関数
完全な PHP Error リファレンスマニュアル
定義と使用法
error_get_last() 関数は最後に発生したエラーを取得します。
この関数は、最後に発生したエラーを配列の形式で返します。エラーが発生していない場合は NULL を返します。
返されるエラー配列には、4つのキー名とキー値が含まれます:
- [type] - エラータイプ
- [message] - エラーメッセージ
- [file] - エラーが発生したファイル
- [line] - エラーが発生した行
構文
error_get_last()
例
<?php
echo $test;
print_r(error_get_last());
?>
echo $test;
print_r(error_get_last());
?>
上記のコードの出力は次のようになります:
Array
(
[type] => 8
[message] => Undefined variable: test
[file] => C:webfoldertest.php
[line] => 2
)
(
[type] => 8
[message] => Undefined variable: test
[file] => C:webfoldertest.php
[line] => 2
)
完全な PHP Error リファレンスマニュアル その他の拡張