RE: [PHP] Parse error: parse error, expecting `']'' in
| From: | Ford, Mike | Date: | Thu, 02 Dec 2004 13:48:34 +0000 |
| Subject: | RE: [PHP] Parse error: parse error, expecting `']'' in | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203343@lists.php.net to get a copy of this message | ||
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
On 02 December 2004 13:22, Robert Sossomon wrote:
> But what I don't understand is why sometimes
> '$_POST[variable]' works and why
> sometimes it will only work when it is '$_POST['variable']' .
>
> Even through my reading and examples I see it both ways, so anyone
> able to give me a direction to go with it? I am thinking of just
> changing my coding to put it the second way, but...???
It's valid to put unquoted array subscripts inside a double-quoted string;
it's not valid anywhere else. Look at the comment at the start of the
second example at
http://uk.php.net/manual/en/language.types.string.php#language.types.string.
parsing.simple for the official position on this.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211