note 105013 added to simplexmlelement.attributes
| From: | jay_milagrosoATyahooDOTcom at osu1 dot php dot net | Date: | Fri, 22 Jul 2011 08:23:41 +0000 |
| Subject: | note 105013 added to simplexmlelement.attributes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181775@lists.php.net to get a copy of this message | ||
$array = array();
$xmlObject = new SimpleXMLElement($data);
foreach ($xmlObject->children() as $child) {
foreach($child->children() as $child1) {
if($child1->attributes()) {
$attribute = $child1->attributes();
foreach($attribute as $a => $b) {
$array[$child->getName()][] = array((string)$child1->getName() =>
(string)$child1, (string)$a => (string)$b);
}
} else {
$array[$child->getName()][] = array((string)$child1->getName() =>
(string)$child1);
}
}
}
Used php 5.3.1
Happy coding!
----
Server IP: 69.147.83.197
Probable Submitter: 120.28.86.168
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.attributes.php
Edit -- https://master.php.net/note/edit/105013
Del: integrated -- https://master.php.net/note/delete/105013/integrated
Del: useless -- https://master.php.net/note/delete/105013/useless
Del: bad code -- https://master.php.net/note/delete/105013/bad+code
Del: spam -- https://master.php.net/note/delete/105013/spam
Del: non-english -- https://master.php.net/note/delete/105013/non-english
Del: in docs -- https://master.php.net/note/delete/105013/in+docs
Del: other reasons-- https://master.php.net/note/delete/105013
Reject -- https://master.php.net/note/reject/105013
Search -- https://master.php.net/manage/user-notes.php