Ok, so lets say you want to loop through an array using foreach but you don’t want to show values, you want to show keys, or you want to show both. Use the following code:
foreach($array as $key => $val) {
Then you can access value via $val and the key via $key.
Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.
This entry was posted on Friday, September 2nd, 2005 at 2:38 pm and is filed under Life. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.