On Wednesday 06 March 2002 13:51, CC Zona wrote:
> In article <[EMAIL PROTECTED]>,
>
> [EMAIL PROTECTED] (Jason Wong) wrote:
> > echo "$doo[dah]"; # is correct
>
> If constant 'dah' is defined, and its value is the name of the key you wish
> to access from array '$doo'. But if the string literall 'dah' is itself
> the name of the key you are trying to access, then the above is *not*
>
> correct. For that, use:
> > echo $doo['dah']; # is correct
>
> or
>
> echo $doo["dah"]; # also correct
<?
define('dah', 'dee');
$doo['dah'] = "Hello";
$doo['dee'] = "World";
echo "$doo[dah]"; echo "<br>"; # Hello
echo $doo[dah]; echo "<br>"; # World
echo $doo['dah']; echo "<br>"; # Hello
?>
:)
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Nothing so needs reforming as other people's habits.
-- Mark Twain
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php