Look at a PHP blog today and note that: "The index key value in PHP, if not enclosed in quotes, interprets the index key value as a constant, which is interpreted as a string when no definition of the constant is found." I'm a little bit convinced because I always enclose the index key in quotes, so this doesn't happen. Take the time to write a line of code to test it:
Copy Code code as follows:
Define (' webhost ', ' blog ');
$WSO = Array ();
$WSO [' blog '] = ' www.weixiaodeyu.com ';
$WSO [' webhost '] = ' www.jb51.net ';
echo $wso [webhost]; Output www.weixiaodeyu.com
Sure enough, the output turned out to be www.weixiaodeyu.com, not www.jb51.net. Now you know the importance of index key values plus quotes. If there is an unexpected mistake, check it. In fact, the strict implementation of the language specification will not appear this difficult to debug errors.