|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-03-18 11:39 UTC] leo dot sten at telia dot com
Hello! I have just installed php4 on my server, I'm running IIS on windows 2000. When I run some scripts that I know work on other servers I get the error: "Warning: Use of undefined constant" and then the constant name etc. Best Regards/ Leo Sten PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 21:00:02 2025 UTC |
Just a fyi, with: print $array[foo]; PHP looks for a constant named foo first, if it does not exist then it'll shout an error of level E_NOTICE and then look for the key foo (which is what you wanted) ... error_reporting can be set about anywhere, including php.ini, .htaccess and the error_reporting() function. And some code: define('a', 'b'); $arr = array('a' => 'apple', 'b' => 'banana'); print $arr[a]; // banana print $arr['a']; // apple Moral of the story is you should always surround your array keys with quotes! ;)