Re: the numeric key of an array???
| From: | Alexander Guevara | Date: | Sat, 21 Dec 2002 02:14:31 +0000 |
| Subject: | Re: the numeric key of an array??? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129044@lists.php.net to get a copy of this message | ||
Yeah this workes fine.. thanks!!
"Philip Olson" <philip@cornado.com> wrote in message
news:Pine.BSF.4.10.10212210135051.36987-100000@localhost...
>
> No, but you can do this:
>
> $arr2 = array_values($array);
>
> print $arr2[0]; // VALUE1
>
> Regards,
> Philip Olson
>
>
> On Fri, 20 Dec 2002, Alexander Guevara wrote:
>
> > How can i do for printing the value of an array given the numeric key
for
> > example i have this code:
> >
> > $array = array (
> > 'VAL1' => "VALUE1",
> > 'VAL2' => "VALUE2",
> > 'VAL3' => "VALUE3"
> > )
> >
> > So the only way i have found to print the value is like this :
> > echo $array['VAL1'];
> >
> > and it prints = VALUE1 but i want to know if its possible to do it
something
> > like this:
> > echo $array[0];
> > i mean give the numeric key for printing VALUE1 so instead the string
key
> > (VAL1) use the numerc (0)
> >
> > Thanks in advance!
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>