On Monday, June 24, 2002, at 12:15  PM, Johnson, Kirk wrote:

> When you echo out an array element, the name needs to be enclosed in
> curlies, e.g.,
>
> echo {$_SERVER['PHP_SELF']}

I think that this is only important when using an associative array 
element reference within certain kinds of quotes.  Like this:

// this won't work b/c of quoting issues
echo "This script is called $_SERVER["PHP_SELF"]";

// this should work fine IIRC
echo "This script is called $_SERVER['PHP_SELF']";

// this should also work if for some reason you needed
// to use double quotes within the array element reference
// (to interpolate a variable, for instance)
echo "This script is called {$_SERVER["PHP_SELF"]}";

// and this is the same thing really
echo "This script is called ${_SERVER["PHP_SELF"]}";





Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to