Yes and even the php manual confirms that its ok to do what I showed:
// The following is okay, as it's inside a string. Constants are not looked for
// within strings, so no E_NOTICE occurs here
print "Hello $arr[fruit]"; // Hello apple
For some reason a few of you in this thread seem to think that I had missed out the single quotes inside the square brackets despite being an sql query wrapped in double quotes. I'm perplexed as to why you all seem to think I've got it so dreadfully wrong when as shown above, the php manual clearly shows this technique is 'okay'.
as it's inside a string. Constants are not looked for within strings