Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php
community creator

How to display all errors in PHP

Chinweuba Elijah Azubuike

Overview

We use the E^ALL in the error_reporting PHP method to detect all possible errors in our code for debugging purposes.

The E^ALL is used inside the error_reporting method to display all errors in a code. We should use it just before deploying our code to production as it exposes vital details about our code.

Coding example

Let's look at the code below:

<?php
trigger_error("user warning!", E_USER_WARNING);
error_reporting(E_ALL);
?>
Using E^ALL

Code explanation

Line 2: We intentionally trigger an error.

Line 3: We allow the error to display using the error_reporting(E^ALL).

Note: Check out the shot on how to turn off error_reporting.

RELATED TAGS

php
community creator

CONTRIBUTOR

Chinweuba Elijah Azubuike
RELATED COURSES

View all Courses

Keep Exploring