I have this array generated:
Code:
$user_info = file_get_contents('http://localhost/rest-server/webservice/api.php?action=get_user&id='.$_GET["id"]);
$user_info = json_decode($user_info, true);
print_r($user_info);
Output:
Array ( [0] =>
Array ( [user_info] =>
Array ( [id] => 12
[first_name] => Test1
[last_name] => User1
[email] => [email protected]
[country] => ABC
[city] => XYZ
)
)
)
How can I use this array? So that I fetch this data like : `$user_info['first_name'];
I want to put a While Loop on Array for Multiple Records like this too:
Array ( [0] => Array ( [user_list] => Array ( [id] => 12 [first_name] => Test1 [last_name] => User1 [email] => [email protected] [country] => ABC [city] => XYZ ) ) [1] => Array ( [user_list] => Array ( [id] => 13 [first_name] => Test2 [last_name] => User2 [email] => [email protected] [country] => XYZ [city] => ABC ) ) )
$user_info[0]["first_name"];$user_info[0]["user_info"]["first_name"];