Re: Can't send message

From: Tom Thackrey (use.signature_at_nospam.com)
Date: 10/07/03


Date: Tue, 07 Oct 2003 15:59:38 GMT


On 7-Oct-2003, Phil Roberts <philrob@HOLYflatnet***.net> wrote:

> With total disregard for any kind of safety measures "Tom
> Thackrey" <use.signature@nospam.com> leapt forth and uttered:
>
> > The script you posted compiles without syntax errors. It does
> > have a problem in that the array subscripts inside a double
> > quoted string should not have single quotes around them. That is
> > it should be "\t$_POST[cpcomp]\n".
>
> Incorrect, all array keys should be quoted unless you're passing
> a constant. If PHP sees an unquoted array key it has to check to
> make sure it isn't a constant before processing it and will
> throw a Notice error.

Not true. Array references inside double quotes behave differently. Inside
double quotes $a[b] is the same as {$a['b']} and constant lookup is not
done.

>From the doc:
// Works but note that this works differently outside string-quotes
echo "A banana is $fruits[banana].";
// Works
echo "A banana is {$fruits['banana']}.";
// Works but PHP looks for a constant named banana first
// as described below.
echo "A banana is {$fruits[banana]}.";
// Won't work, use braces. This results in a parse error.
echo "A banana is $fruits['banana'].";

http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.simple

-- 
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)