Home / PHP Tips Generated By ChatGPT / Displaying the Last Error Message in PHP Retrieve the last error message using error_get_last(). Source Code @trigger_error("Custom error"); print_r(error_get_last());