note 46087 added to function.simplexml-element-attributes
| From: | tychay@php.net | Date: | Tue, 28 Sep 2004 23:31:22 +0000 |
| Subject: | note 46087 added to function.simplexml-element-attributes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77547@lists.php.net to get a copy of this message | ||
Why bother iterating over all the elements when they are already indexed? something like...
function simplexml_find_attribute(SimpleXMLElement $element, $attributeName) {
$attrs = $element->attributes();
if (isset($attrs[$attributeName])) {
return (string) $attrs[$attributeName];
}
return false;
}
- terry
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-element-attributes.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46087
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46087&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46087&report=yes
Search -- http://master.php.net/manage/user-notes.php