How To Use Error_reporting Method PHP Example?

PHP 8 , PHP

Nicesnippets

415

23-08-2021


How To Use Error_reporting Method PHP Example?

Hi guys,

Today i will explained How To Use Error_reporting Method in PHP. This example is so easy to use in php.

The error_reporting() function in php sets the error_reporting directive at runtime. When you set error_reporting in script, it sets temporary error reporting while running script.

So let's start to the example.

Syntax


error_reporting(level);

Level optional integer or predefined constants with pipe sign. Here is example below:

Example

<?php

// disable all error reporting

error_reporting(0);

// simple running errors

error_reporting(E_ERROR | E_WARNING | E_PARSE);

// all errors except E_NOTICE

error_reporting(E_ALL & ~E_NOTICE);

// all PHP errors

error_reporting(E_ALL);

// all PHP errors

error_reporting(-1);

// as error_reporting(E_ALL);

ini_set('error_reporting', E_ALL);

?>

Constant

Now you can check your own.

I hope it can help you...


Recommended Posts