Jump to content

[SOLVED] Error reporting except...


richrock

Recommended Posts

I've been using php error reporting to refine some code I've written.  I've checked out the manual, and am currently using

error_reporting(E_ALL)

but this throws up a lot of Undefined Index errors, most of which I know about, and as it's a multifunction page, I don't really need to deal with.

 

Being the relative n00b at PHP, and never having used error_reporting, how could I use it to report all errors 'except' this undefined index?

Link to comment
Share on other sites

Each line of code that php encounters that triggers an undefined error or any other error takes 10-20 times longer to execute because php must go through its error response code to deal with it. Turning off error_reporting only affects the last step in that error response code of actual reporting the error. Which is why the setting is called error_reporting and not fixed_your_actual_code_so_it_no_longer_generates_an_error()

 

Use isset() or empty() to test a variable that might not exist at runtime. Code should not normally be generating any type of errors when it executes.

Link to comment
Share on other sites

many thanks!  It seems I'll have to do some research on the isset() and empty() to help improve the code speed, although that's not a great issue here, as the script's only going to be used by a maximum of four people ever, and seems plenty fast enough (just basic form handling for names & addresses)...

 

Thanks again all!  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.