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
https://forums.phpfreaks.com/topic/231293-undefined-index/#findComment-1190407
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
https://forums.phpfreaks.com/topic/231293-undefined-index/#findComment-1190420
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.