U3F1ZWV6ZTc5OTgzNDMxMzE1MzJfRnJlZTUwNDYwNDY0NzA3Nzc=

How can I get useful error messages in PHP?



How can I get useful error messages in PHP

Question:
Frequently I will attempt to run a PHP content and simply recover a clear screen. No mistake message; only a vacant screen. The reason may have been a basic language structure mistake (wrong section, missing semicolon), or a bombed work call, or something different completely.

It is exceptionally hard to make sense of what turned out badly. I wind up remarking out code, entering "reverberation" articulations all over the place, and so forth attempting to limit the issue. In any case, there most likely should be a superior way, isn't that so?

Solution :
error_reporting
(PHP 4, PHP 5, PHP 7)

error_reporting - Sets the level of PHP error reporting

Description
error_reporting ([int $ level]): int
error_reporting () modifies the error_reporting directive during script execution. PHP has several levels of errors, use this function configures this level for the duration (of execution) of your script. If the optional level parameter is not defined, error_reporting () will return only the current error reporting level.

The following enables all errors:
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
if you want to improve the solution,
comment to help the community
Comments
No comments
Post a Comment

Post a Comment

NameEmailMessage