Re: A problem with associative arrays..
| From: | Rasmus Lerdorf | Date: | Sat, 29 Jul 2000 18:56:20 +0000 |
| Subject: | Re: A problem with associative arrays.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8980@lists.php.net to get a copy of this message | ||
There is no solution. Rethink the way you are doing things.
-Rasmus
On Fri, 28 Jul 2000, Lez Lytollis wrote:
> Did anyone come up with a solution for this? - I'm having exactly the same
> problem at the moment.
>
> Cheers
> Lez
>
> ----- Original Message -----
>
> > > > He's not defining it as a string. He's accessing it as an array.
> > > > Does it still apply? What if he defined $conf to be an array
> > > > prior to this?
> > >
> > > Think of it this way:
> > >
> > > $conf['db'] = "testdb";
> > >
> > > Now, when you try to assign something to $conf['db']['host'] the
> > > $conf['db'] part is "testdb", what would
> > > "testdb"['host'] be? Since
> > > $cond['db'] is a string, the 'host' index of this string is the
> > > same as
> > > "testdb"[0] which is the first position of the string. So when you do:
> > >
> > > $conf['db']['host'] = "dbhost";
> > >
> > > You end up with, "destdb", because there is only room for the first
> > > character of "dbhost" in the $conf['db'][0] slot.
> >
> >
> > I guess I just have to fix up a work around to this. :)
> >
>
>
>
>