Jump to content
Larry Ullman's Book Forums

Chapter 8 Error Handling And Debugging


Recommended Posts

On page 252 it says when the error reporting is turned off (set to zero), php does not display any errors. But when I tried to do the same, it actually displayed errors. I am using php version 5.5.25. Could something be wrong with my version or is there something I do not know?

This is what I did:

 

error_reporting(0);

//Create errors:

foreach ($var as $v) {}

$result = 1/0;

 

And I got this result:

 

Testing Error Reporting

 

Notice: Undefined variable: var in /Applications/MAMP/htdocs/php/report_errors.php on line 16

 

Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/php/report_errors.php on line 16

 

Warning: Division by zero in /Applications/MAMP/htdocs/php/report_errors.php on line 17

Link to comment
Share on other sites

Thanks! Will check it out and adjust accordingly :) ... Sorry about the wrong version. I am actually using 5.4.8 . I looked at the wrong place. I checked on top of Mysql terminal where I log in and it said my server version was 5.5.25 Source distribution. This, I mistook for a php version.

Link to comment
Share on other sites

 Share

×
×
  • Create New...