phpday 2027 - Call for Papers

エラー処理

目次

エラーは、アプリケーションの開発やライフサイクルの中でごく普通に起こるものです。 そのため PHP には、エラーを報告したり、エラーに対処したりする方法が複数用意されています。

PHP がエラーを報告する仕組みには、主に次のふたつがあります。

  • Throwable エラー。これはさらに、 Error クラス配下のプログラミング上のエラーと、 Exception クラス配下の回復可能なエラーに分かれます。 これらのエラーは、throw キーワードでスローでき、catch キーワードでキャッチできます。

  • 診断エラー。これは、深刻度ごとに分類されます。

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top