How to display only certain PHP errors
In PHP you can set display_errors = yes in the php.ini. This is pretty much all or nothing.
Say you have a script, and you only want to display errors for a specific section you're working on, but not the whole thing. Here's what to do, assuming the global display_errors = no. If it's not, just add ini_set("display_errors","no"); towards the top of your code before any source of possible errors.
<?php
print("Here's some code that you don't want errors to display on.");
ini_set("display_errors","on");
print("Here's some code that you want to display errors for.");
ini_set("display_errors","off");
print("Here's some code that you don't want errors to display on.");
?>
print("Here's some code that you don't want errors to display on.");
ini_set("display_errors","on");
print("Here's some code that you want to display errors for.");
ini_set("display_errors","off");
print("Here's some code that you don't want errors to display on.");
?>
[Click to add or edit comments])
Please prepend comments below including a date