Re: [PHP] Echo array string index?

2005-07-17 Thread Ben-Nes Yonatan

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



Unless I didnt understood you.. you can easily use foreach() for that.
If you want to loop over it again and again and echo it inside you can 
also just make a for() loop and in it make print_r(), if you want to use 
the values of the array inside the for() you can again use foreach() 
inside it just remember that after the foreach() end you need to do 
reset() to the array to repeat the process again with the for().


Cheers,
Ben-Nes Yonatan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Echo array string index?

2005-07-13 Thread Matt Darby

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