Is it okay to use array[key] in PHP?
Is it okay to use array without single or double quotion like $array[key]? I thought it is bad because PHP look for constant first if I don't use single or double quotation. One of my colleagues told me that it does not matter. What do you guys think? It is not considered as OK -- even if it will work in most cases. Basically, when PHP sees this : echo $array[key]; It will search for a constant, defined with define , called key -- and, if there is none, if will take the 'key' value. But, if there is something like this earlier in your code : define('key', 'glop'); It will not take echo $array[