Normally when working with PHP, it is a common thing that warning and notices are not shown. It is to some extend a good practice to hide all these since warnings and notices bring a negative impression from a end user. For a developer this should be something to be of greater importance. Developer should be able to identify and fix all warnings and notices, similarly as with the error messages.
Now how to display warning and notice messages from our code itself, without changing any server settings.
Add the following line of code to the start of the code;
Note, E_ALL is a constant and should not be given within quotes !!
This will list all the warnings, errors and notices which can be separately mentioned using;
E_NOTICE | E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE
There are some more useful functions;
ini_get() – This is used to get the values for different settings.
Example : echo ini_get(“display_errors”);
ini_set() – This is used to set the values.
Example : echo ini_set(“display_errors”,”1″);
ini_get_all() – This will return all the configuration options set. Note, the return type is a multi-dimensional array.