note 88025 added to book.dom
| From: | nospam at ya dot ru | Date: | Tue, 06 Jan 2009 18:18:32 +0000 |
| Subject: | note 88025 added to book.dom | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148894@lists.php.net to get a copy of this message | ||
<?PHP
function dom2array_full($node){
$result = array();
if($node->nodeType == XML_TEXT_NODE) {
$result = $node->nodeValue;
}
else {
if($node->hasAttributes()) {
$attributes = $node->attributes;
if(!is_null($attributes))
foreach ($attributes as $index=>$attr)
$result[$attr->name] = $attr->value;
}
if($node->hasChildNodes()){
$children = $node->childNodes;
for($i=0;$i<$children->length;$i++) {
$child = $children->item($i);
if($child->nodeName != '#text')
if(!isset($result[$child->nodeName]))
$result[$child->nodeName] = dom2array($child);
else {
$aux = $result[$child->nodeName];
$result[$child->nodeName] = array( $aux );
$result[$child->nodeName][] = dom2array($child);
}
}
}
}
return $result;
}
?>
----
Server IP: 195.54.192.44
Probable Submitter: 127.0.0.1
----
Manual Page -- http://www.php.net/manual/en/book.dom.php
Edit -- https://master.php.net/note/edit/88025
Del: integrated -- https://master.php.net/note/delete/88025/integrated
Del: useless -- https://master.php.net/note/delete/88025/useless
Del: bad code -- https://master.php.net/note/delete/88025/bad+code
Del: spam -- https://master.php.net/note/delete/88025/spam
Del: non-english -- https://master.php.net/note/delete/88025/non-english
Del: in docs -- https://master.php.net/note/delete/88025/in+docs
Del: other reasons-- https://master.php.net/note/delete/88025
Reject -- https://master.php.net/note/reject/88025
Search -- https://master.php.net/manage/user-notes.php