Saturday, March 7, 2009

PHP Notice: Use of undefined constant

When I moved my PHP code from development to production, I encountered the follow message.

Notice: Use of undefined constant abc.

It doesn't affect the nomral operation of the function, but made my website looks pretty ugly.
It's because I used the array like item[apple] inside my php program. The solution for the problem is very simple. Just need to quote the key of the array something like. item['apple'] or item["apple"]. Then the Notice warning will not show and give you a nice and clear result page.

No comments: