Looping in a multidimensional Array using PHP -
i'm having hard time looping in multidimensional array. i'm not expert of sort when comes php. want happen search field. if hits right field, grab data , store in variable , if not hit right field, continue search right field.
here's array
[111] => array ( [tag] => b:value [type] => close [level] => 7 ) [112] => array ( [tag] => b:keyvalueofinthealthagencyd9j3w_pir [type] => close [level] => 6 ) [113] => array ( [tag] => a:agencies [type] => close [level] => 5 ) [114] => array ( [tag] => a:token [type] => complete [level] => 5 [value] => vy8bms8ndifdqwrtb6wyndggumgbzhtoxu6mhqzgdxhrabi0qkwluk9pjt03oqyf ) [115] => array ( [tag] => logincaregiverportalresult [type] => close [level] => 4 ) [116] => array ( [tag] => logincaregiverportalresponse [type] => close [level] => 3 ) [117] => array ( [tag] => s:body [type] => close [level] => 2 ) [118] => array ( [tag] => s:envelope [type] => close [level] => 1 )
and here's code , apologize first not being able complete it. :d ......i have totally no idea on place.....and searching making me more confuse...sorry....
here's code
$last = count($vals) - 1; foreach ($vals $i => $row) { if (!$vals == '114') { next } else { $sessiontoken = <------store value here } }
try following:
foreach ($values $key => $value){ if ($key == '114') { if($value['tag']==='a:token') $sessiontoken = $value['value']; } }
Comments
Post a Comment