how to view all members of an array?

Discussion in 'PHP' started by Liza New, Oct 2, 2009.

  1. #1
    Hi Friends
    I m facing problem to view all members of an array
    Plz help..... how to............... i m new to php
     
    Liza New, Oct 2, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    
    print_r($array);
    var_dump($array);
    var_export($array);
    
    PHP:
     
    AsHinE, Oct 2, 2009 IP
  3. lmao

    lmao Guest

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    is this help?
     
    lmao, Oct 3, 2009 IP
  4. goliath

    goliath Active Member

    Messages:
    308
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Yes it is the answer. Any one of those lines of code will display the entire contents of an array. Var_dump and print_r will also display the structure, I haven't used _export before.
     
    goliath, Oct 3, 2009 IP
  5. renownedmedia

    renownedmedia Well-Known Member

    Messages:
    65
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    100
    #5
    foreach($array AS $key => $value) {
    echo $value."\n";
    }
     
    renownedmedia, Oct 3, 2009 IP