By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,956 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

Print out array keys only

P: n/a
Hi, there are lots of examples that show you how to print array values
given a key. Do you know how to print keys for a given array.

example

$myArray = array('a'=>1, 'b'=>2, 'c'=>3, 'd'=>4);

How do you print 'a', 'b', 'c','d' only without using any loops?

Thanks in advance for all your help
Undbund

May 20 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
undbund kirjoitti:
Hi, there are lots of examples that show you how to print array values
given a key. Do you know how to print keys for a given array.

example

$myArray = array('a'=>1, 'b'=>2, 'c'=>3, 'd'=>4);

How do you print 'a', 'b', 'c','d' only without using any loops?

Thanks in advance for all your help
Undbund
echo implode(', ', array_keys($myArray));

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
May 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.