#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Phnom penh, Cambodia
    Posts
    11
    Rep Power
    0

    Multi dimensional array


    Hi all,

    I have a problem with multi dimension array.

    I would like to assing and get value from 2 dimensional array, please help.

    I need sth like:


    $arr['id'][0]
    $arr['id'][1]
    $arr['name'][0]
    $arr['name'][1]


    thanks in advanced.
    MONY
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,196
    Rep Power
    10
    Can you rephrase your question? Its not clear from your post what you're trying to accomplish, so I'm not sure what to advise.

    Thanks.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
    The Most Important Article You Can Read as a Developer
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Phnom penh, Cambodia
    Posts
    11
    Rep Power
    0
    drgroove,
    I mistakenly posted the same thread in 2 forum.Now i've got the answer from PHP forum.
    It meets my need.

    To assign value:

    $arr['id'][0] = "value1";
    $arr['id'][1] = "value2";
    $arr['name'][0] = "value3";
    $arr['name'][1] = "value4";

    To display:

    echo $arr['id'][0];
    echo $arr['id'][1];
    echo $arr['name'][0];
    echo $arr['name'][1];

    thank you anyway.
    MONY
    Last edited by keomony; September 14th, 2003 at 09:07 PM.
  6. #4
  7. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,196
    Rep Power
    10
    OK - glad to hear you've gotten the solution you needed on this.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
    The Most Important Article You Can Read as a Developer

IMN logo majestic logo threadwatch logo seochat tools logo