Re: Array question
| From: | Dan Lowe | Date: | Sun, 18 Feb 2001 04:56:30 +0000 |
| Subject: | Re: Array question | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40397@lists.php.net to get a copy of this message | ||
No - PHP arrays aren't arrays in the traditional sense like you would find
in C or Perl... it's more like Perl's hash (or associative array). It's
just a set of key/value pairs. In some cases you would use numbes instead
of alphanumeric labels but PHP treats it all the same way, basically.
-dan
Previously, Chris said:
> Ok,
> But can't the array still be refered to with a number?
> So in myarray["something"] is the 50th element in the array, wouldn't:
>
> myarray[49] = myarray["something"]
>
> ?
>
>
>
> > On Thursday 15 February 2001 01:40, Chris wrote:
> >
> > > How do I get the index,number of an array if reffering to an array via
> > > string? Ex:
> > > I have 100 arrays, and I want to know what # myarray["something"] is.
> >
> > That element doesn't have an index number such arrays are implemented as
> > hashes or trees, which don't store data at "fixed positions" (that's a
> >
> > very bad explanation, but, well...)
> > The "index" is the "key" in this case - in your example it's
> > "something".
> >
> > --
> > Christian Reiniger
> > LGDC Webmaster (http://sunsite.dk/lgdc/)
> >
> > I saw God --------- and she was black.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/
If a man is standing in the middle of the forest speaking and there is
no woman around to hear him... is he still wrong? -George Carlin