menu

Debugging in PHP

Debugging in PHP - Important Points


11. What does the function debug_print_backtrace() do in PHP?

A. Displays the current stack trace

B. Displays the current error message

C. Displays a list of all variables in the current scope

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The debug_print_backtrace() function displays the current stack trace.

12. What is the purpose of the function assert() in PHP?

A. To stop the execution of the script on an error

B. To display errors in the browser console

C. To log errors to a file or database

D. To test if a condition is true and trigger an error if it is not

Discuss Work Space

Answer: option d

Explanation:

The assert() function is used to test if a condition is true and trigger an error if it is not.

13. What is the purpose of the function error_reporting() in PHP?

A. To turn off error reporting

B. To set the level of error reporting

C. To display all errors

D. To log errors to a file or database

Discuss Work Space

Answer: option b

Explanation:

The error_reporting() function is used to set the level of error reporting for the current script.

14. What does the function set_exception_handler() do in PHP?

A. Sets a custom function to handle uncaught exceptions

B. Sets a custom function to handle runtime errors

C. Sets a custom function to handle syntax errors

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The set_exception_handler() function is used to set a custom function to handle uncaught exceptions in PHP.

15. What is the purpose of the function error_log() in PHP?

A. To display errors in the browser console

B. To log errors to a file or database

C. To stop the execution of the script on an error

D. None of the above

Discuss Work Space

Answer: option b

Explanation:

The error_log() function is used to log errors to a file or database.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now