note 88658 deleted from function.get-object-vars by danbrown
| From: | danbrown@php.net | Date: | Mon, 02 Feb 2009 16:42:42 +0000 |
| Subject: | note 88658 deleted from function.get-object-vars by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150107@lists.php.net to get a copy of this message | ||
Note Submitter: huzursuz at mailinator dot com
----
better version of conv_obj, based on XML... this converts XML to an array... use it by
$result = xmlobj2arr(simplexml_load_string($xmlContent));
function xmlobj2arr($Data) {
if (is_object($Data)) {
foreach (get_object_vars($Data) as $key => $val) {
$ret[$key] = xmlobj2arr($val);
}
return $ret;
} elseif (is_array($Data)) {
foreach ($Data as $key => $val) {
$ret[$key] = xmlobj2arr($val);
}
return $ret;
} else {
return $Data;
}
}