PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
sallaudin
Forum Newbie
Posts: 1 Joined: Mon Jan 20, 2014 2:02 pm
Post
by sallaudin » Mon Jan 20, 2014 2:07 pm
Code: Select all
$json = '{"Data":{"Date":"08:09 20-01-2014","SchoolID":"923214157777","Type":"1","Nic":["3520135201001","3520135201002","3520135201003"]}}';
$main_array=json_decode($json);
foreach($main_array->Data as $key=>$value ) {
if(is_array($value)) {
echo "$Date:\n";
} else {
echo "$key => $value\n";
}
i am using this approach but i want to get the values on the behalf of keys and get all the nic in one go
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Mon Jan 20, 2014 4:00 pm
$main_array->Data->Nic
(#10850)