Re: Re: Value of $_* variables
| From: | Jason Wong | Date: | Wed, 06 Mar 2002 06:18:28 +0000 |
| Subject: | Re: Re: Value of $_* variables | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87432@lists.php.net to get a copy of this message | ||
On Wednesday 06 March 2002 13:51, CC Zona wrote:
> In article <php.general-87415@news.php.net>,
>
> php-general@gremlins.com.hk (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
*/