Re: array variables with or without quotes

From: Date: Wed, 22 Feb 2006 05:52:39 +0000
Subject: Re: array variables with or without quotes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230876@lists.php.net to get a copy of this message
When I tried to run this, PHP treated the word -include- as a control structure rather than an index name. Understandable. So, I put it in single quotes ('include') to see what would happen and it works fine. But I don't understand why! What is the difference between $content_row [include] and $content_row['include']? I have been unable to resolve this question in the php manual, I need enlightenment.
Without quotes it could be constant or defined variable: define('variable', 'blah blah blah'); so then I can just use: <?php define('variable', 'blah blah blah'); echo variable; ?> will print out: blah blah blah So in your case, it's checking for a defined variable called 'include' which doesn't exist (and prints out a warning/notice).

« previous php.general (#230876) next »