You are here: RE: [PHP] Re: Echo array string index? « PHP « IT news, forums, messages
RE: [PHP] Re: Echo array string index?

Posted by "yanghshiqi" on 10/21/78 11:21

Yeah, you can use foreach.
But *may be* you just find sth called array_keys().




Best regards,
Shiqi Yang

-----Original Message-----
From: Joe Harman [mailto:cjharman@gmail.com]
Sent: Thursday, July 14, 2005 4:45 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: Echo array string index?

Hey Matt,
you can print out the contents of your array by using print_r($arr)
but more useful is using this
foreach ($arr as $key => $value)
{
echo "Key : ".$key." Value : ".$value;
}
Adios
Joe
On 7/13/05, Adam Hubscher <webmaster@offbeat-zero.net> wrote:
>
> Matt Darby wrote:
> > I have an array setup as such: *$arr['generated text']='generated
> number';*
> >
> > What would be the best way to echo the key in a loop?
> > Seems pretty easy but I've never attempted...
> >
> > Thanks all!
> > Matt Darby
> >
> I'm not sure I understand the question.
>
> You could do foreach($arr as $key => $value) { print($key); }.
>
> There are also a number of functions that get the current key on the
> array's pointer:
>
> http://us2.php.net/manual/en/function.key.php
> http://us2.php.net/manual/en/function.array-keys.php
>
> But once again, it really comes down to what exactly it is you want to
> do...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Joe Harman
---------
Do not go where the path may lead, go instead where there is no path and
leave a trail. - Ralph Waldo Emerson

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация