SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2002
    Location
    Maryland
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I loop through a two dimensional array with unknown keys?

    What is the best way to loop through an array with unknown keys: Here is an example:

    PHP Code:
    Array ( [1] => Array ( [bar_name] => bob [year_admitted] => 1485 ) [4] => Array ( [bar_name] => carol [year_admitted] => 7751 ) ) 
    Any help is greatly appreciated.

  2. #2
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    foreach

  3. #3
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was wrong. Yes. use the foreach loop.

    http://www.tizag.com/phpT/foreach.php
    I live in Madison. Where in the W1RLD do you live?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •