Suppressing errors in PHP

Spread the love

Many times you find that while coding you get errors or warnings in the output. If you don’t want to show those errors in your output or for suppressing errors in PHP, you can use two methods.
  1. Adding @ symbol before the line where you think the error may occur.
  2. Adding function error_reporting(0) before/top of your script.

Examples:

1. 

<?php 
@print(0/100);
?>

2. 

<?php
error_reporting(0);
print(0/100);
?>


Spread the love

Leave a Comment