jeudi 5 juin 2014

trying to get jason field value with 3rd foreach inside foreach


Vote count:

0




I am trying to get value of subscriber id but i am getting php error on 3rd foreach.



$content = '{"12345":{"id":"123","data":{"sort":"desc","subcriber":{"id":321"}}}';
$json = json_decode($content, true);

foreach($json as $row => $val) {
echo $val['id'];
$jdata = $val['data']

foreach($jdata as $data => $val2) {
echo $val2['sort'];
$jsubcriber = $val2['subcriber']

foreach($jsubcriber as $subcriber => $val3) {
echo $val3['id'];

}
}
}


asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire