how to display the array element seperately

Discussion in 'PHP' started by kumar84, Aug 6, 2007.

  1. #1
    hai friends,

    print_r($face->client->usersInfo($uids, $field));

    If i use this code in my program it will display the output as below

    Array ( [0] => Array ( [uid] => 100
    [current_location] => Array ( [city] => chennai
    [state] => TamilNadu
    [country] => India
    [zip] => 600530 ) ) )

    What i need is , I want to display it seperately from the array
    (ie) i want to fetch from this array, and want to display the array element seperately

    City chennai
    state TamilNadu
    country India

    How i need to do php code for this

    can one help regards this
    Thanks in advance
     
    kumar84, Aug 6, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    function showLocationInfo($data) {
        foreach ($data[0] as $k->$v)
            echo ucfirst($k) . ": $v<br />";
    }
    
    showLocationInfo($face->client->usersInfo($uids, $field));
    PHP:
    Assuming the usersInfo() method only returns one location in the array
     
    krt, Aug 6, 2007 IP