The difference between the key of php array index with quotes and without quotes

I noticed this sentence when reading a PHP blog today: "If the index KEY value in PHP is not enclosed in quotation marks, the index KEY value will be interpreted as a constant. When the definition of the constant is not found, it will be interpreted Interpreted as a string". I don't believe it a little bit, because I always enclose the index KEY in quotation marks, so this does not happen. Take advantage of the time to write a line of code to test: Copy the code as follows: define('WEBHOST','blog'); $wso = array(); $wso['blog'] ='www.weixiaodeyu.com'; $wso['WEBHOST'] ='www.jb51.net'; echo $wso[WEBHOST]; //output ww

Guess you like

Origin blog.csdn.net/zl17822307869/article/details/114024851