At 01:42 24.02.2003, Jason Lange spoke out and said:
--------------------[snip]--------------------
>What you might try is removing the single-quotes from around PHP_SELF.
>
>Before: $_SERVER['PHP_SELF']
>After: $_SERVER[PHP_SELF]
This is only valid if the array is contained within a double quoted string
- it will generate a parser warning outside a string (undefind constant
PHP_SELF).
>Another note: as far as I can tell you do not need the braces ({}) to
>enclose a variable within a double-quoted string. I may be wrong, but
>nothing I've read advocates doing this, and I've never had a problem
>with my code when I've written it this way.
The docs on strings
(http://www.php.net/manual/en/language.types.string.php) clearly states this:
"If a dollar sign ($) is encountered, the parser will greedily take as much
tokens as possible to form a valid variable name. Enclose the variable name
in curly braces if you want to explicitly specify the end of the name."
$fruits = array('strawberry' => 'red', 'banana' => 'yellow');
// 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'].";
// Works
echo "A banana is " . $fruits['banana'] . ".";
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php