note 42692 modified in simplexmlelement.attributes by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 15:39:26 +0000 |
| Subject: | note 42692 modified in simplexmlelement.attributes by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160644@lists.php.net to get a copy of this message | ||
here's a simple function to get an attribute by name, based on the example
<?php
function findAttribute($object, $attribute) {
foreach($object->attributes() as $a => $b) {
if ($a == $attribute) {
$return = $b;
}
}
if($return) {
return $return;
}
}
?>
--was--
here's a simple function to get an attribute by name, based on the example
<?php
function findAttribute($object, $attribute) {
foreach($object->attributes() as $a => $b) {
if ($a == $attribute) {
$return = $b;
}
}
if($return) {
return $return;
}
}
?>
http://php.net/manual/en/simplexmlelement.attributes.php