Câu hỏi phỏng vấn PHP
Câu hỏi

Explain the Exception Hie...

Câu trả lời

In PHP 7, the Exception hierarchy was updated with the introduction of the Error class. Here's an explanation of the key differences between Error and ErrorException:

  • Error is a new base class introduced in PHP 7 that represents internal PHP errors, such as parsing errors or type errors. It is used for all fatal errors that cannot be recovered from[1].

  • ErrorException is a subclass of Exception that allows PHP errors to be handled like exceptions. It has existed since PHP 5.1[1].

  • The main difference is that Error is used for internal PHP errors, while ErrorException is used for converting PHP errors to exceptions[1].

  • Error has a $severity property that ErrorException lacks. This property indicates the severity level of the error[1].

  • You should use Error to catch all internal PHP errors, but not for your own custom exceptions. For custom...

senior

senior

Gợi ý câu hỏi phỏng vấn

junior

Is there a difference between isset and !empty ?

junior

What does the 'var' keyword mean in PHP?

middle

Does PHP support method overloading?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào