menu

Debugging in PHP


1. What does the function error_get_last() do in PHP?

Returns the last error that occurred in the script

Returns the last warning that occurred in the script

Returns the last notice that occurred in the script

None of the above


2. Which of the following is NOT a type of error that can occur in PHP code?

Syntax errors

Runtime errors

Logical errors

None of the above


3. What is the purpose of the function set_error_handler() in PHP?

To turn off error reporting

To set the level of error reporting

To handle errors with a custom function

To stop the execution of the script on an error


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

Sets a custom function to handle uncaught exceptions

Sets a custom function to handle runtime errors

Sets a custom function to handle syntax errors

None of the above


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

To display errors in the browser console

To log errors to a file or database

To stop the execution of the script on an error

None of the above


6. What does the function debug_backtrace() do in PHP?

Displays the current stack trace

Displays the current error message

Displays a list of all variables in the current scope

None of the above


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

To display errors in the browser console

To log errors to a file or database

To stop the execution of the script on an error

None of the above


8. What is the purpose of the function set_time_limit() in PHP?

To turn off error reporting

To set the maximum execution time for a script

To display all errors

To stop the execution of the script on an error


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

Displays the current stack trace

Displays the current error message

Displays a list of all variables in the current scope

None of the above


10. What is the difference between the var_dump() and print_r() functions in PHP?

There is no difference, they are synonyms

var_dump() displays the type and value of a variable, print_r() only displays the value

print_r() displays the type and value of a variable, var_dump() only displays the value

None of the above