Re: A problem with associative arrays..
| From: | Rasmus Lerdorf | Date: | Wed, 26 Jul 2000 20:19:58 +0000 |
| Subject: | Re: A problem with associative arrays.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8397@lists.php.net to get a copy of this message | ||
Put single quotes around your array indices.
-Rasmus
On Wed, 26 Jul 2000, Warren Vanichuk wrote:
>
> Ok, I have just discovered that I cannot mix 'dimensions' in an associative
> array.
>
> The source I have :
>
> <?php
>
> $conf[db] = "bazfoobar";
> $conf[db][host] = "thishost";
>
> echo "value is: " . $conf[db] . "<br>";
> echo "host is: " . $conf[db][host] . "<br>";
>
> $conf[db] = "foobarbaz";
> $conf[db][host] = "somehost";
>
> echo "value is now : " . $conf[db] . "<br>";
> echo "host is now : " . $conf[db][host] . "<br>";
>
> php?>
>
>
> Generates :
>
> value is: tazfoobar
> host is: t
> value is now : soobarbaz
> host is now : s
>
> Is this expected behaviour in PHP3? Can I actually do this in PHP4? Do I
> have to ensure that all of my associative arrays have the exact same
> dimensions?
>
> Suggestions? Hints? Valium? :)
>
> TIA.. :)
>
> Sincerely, Warren
>
>
>