note 117822 added to simplexmlelement.attributes
| From: | andy dot locologic+101 at gmail dot com | Date: | Fri, 14 Aug 2015 10:00:37 +0000 |
| Subject: | note 117822 added to simplexmlelement.attributes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203344@lists.php.net to get a copy of this message | ||
Easiest and safest way to get attributes as an array is to use the iterator_to_array function (see
http://php.net/manual/en/function.iterator-to-array.php):
<?php
$x = new SimpleXMLElement('<div class="myclass"
id="myid"/>');
$attributes = iterator_to_array($x->attributes());
?>
----
Server IP: 72.52.91.14
Probable Submitter: 86.133.30.196
----
Manual Page -- http://php.net/manual/en/simplexmlelement.attributes.php
Edit -- https://master.php.net/note/edit/117822
Del: integrated -- https://master.php.net/note/delete/117822/integrated
Del: useless -- https://master.php.net/note/delete/117822/useless
Del: bad code -- https://master.php.net/note/delete/117822/bad+code
Del: spam -- https://master.php.net/note/delete/117822/spam
Del: non-english -- https://master.php.net/note/delete/117822/non-english
Del: in docs -- https://master.php.net/note/delete/117822/in+docs
Del: other reasons-- https://master.php.net/note/delete/117822
Reject -- https://master.php.net/note/reject/117822
Search -- https://master.php.net/manage/user-notes.php