Jump to content

undefined index


cruxaders

Recommended Posts

The issue is present in either case. The difference is that Xampp suppresses errors in the php.ini file.

Either way, the issue is common when you don't enclose indexes in quotes, like when you fetch information from a database for example.

 

So instead of $r[index], you should use $r['index']

 

Your code will still works however, even with these "errors" present.

Link to comment
Share on other sites

It may 'work' now, but what if a constant is defined with the same name as an unquoted index? It's also inefficient, as now php has to search for a constant by that name, then decide that none exists, and treat the value as a string. It also generates a notice, whether it's displayed or not, AFAIK.

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.