note 89702 added to function.simplexml-element-children
| From: | hoseinnjatgoogle' | Date: | Thu, 19 Mar 2009 19:25:08 +0000 |
| Subject: | note 89702 added to function.simplexml-element-children | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152163@lists.php.net to get a copy of this message | ||
Quick easy way to turn objectified SimpleXMLElement data into an array.
function get_xml_from_some_source(){
//blah blah blah build cUrl
$data = @curl_exec($ch);
$newdata = new SimpleXMLElement($data);
$new = xml2array_parse($newdata);
}
function xml2array_parse($xml){
foreach ($xml->children() as $parent => $child){
$return["$parent"] =
xml2array_parse($child)?xml2array_parse($child):"$child";
}
return $return;
}
My first post, be nice. ;-)
----
Server IP: 208.69.120.35
Probable Submitter: 65.51.54.130
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-element-children.php
Edit -- https://master.php.net/note/edit/89702
Del: integrated -- https://master.php.net/note/delete/89702/integrated
Del: useless -- https://master.php.net/note/delete/89702/useless
Del: bad code -- https://master.php.net/note/delete/89702/bad+code
Del: spam -- https://master.php.net/note/delete/89702/spam
Del: non-english -- https://master.php.net/note/delete/89702/non-english
Del: in docs -- https://master.php.net/note/delete/89702/in+docs
Del: other reasons-- https://master.php.net/note/delete/89702
Reject -- https://master.php.net/note/reject/89702
Search -- https://master.php.net/manage/user-notes.php