Help with iterating through array php -
i want return 'message->text' part of array. can me? having difficulty this.
array ( [name] => new exp [created] => array ( [date] => 20110304 [time] => 11:09:27 [version] => 2.02.6 ) [message] => array ( [0] => array ( [@attributes] => array ( [id] => 0 [mbox] => recipe ) [received] => array ( [date] => 20090304 [time] => 13:16:48 ) [from] => array ( [name] => andrew welch [email] => <email address removed> ) [to] => array ( [name] => <email address removed> [email] => <email address removed> ) [messageid] => <email address removed> [subject] => aloo paranthas [text] => take potatoes ... cook. [attachment] => array ( [name] => part-003.html [dir] => page0001/000000 [bytes] => 864 [size] => 864.00 b [type] => text/html ) [mboxname] => recipe ) [1] => array ( ...
the array structure so:
array ( ... [message] => array ( [0] => array ( ... [text] => take potatoes ... cook. ... ) [1] => array ( ... ) ... ) ) so $data['message'] array:
for($i = 0, $l = count($data['message']); $i < $l ; $i++) { echo $data['message'][$i]['text']; } i suggest read arrays in php.
Comments
Post a Comment