note 98116 deleted from simplexmlelement.addAttribute by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Jan 2011 14:34:48 +0000 |
| Subject: | note 98116 deleted from simplexmlelement.addAttribute by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176469@lists.php.net to get a copy of this message | ||
Note Submitter: Yuri Vecchi
----
If you want to "chain" SimpleXMLElement::addAttribute like this:
<?php
$element->addAttribute('number','one')->addAttribute('letter',two');
?>
extend the SimpleXMLElement class like this:
<?php
class SimpleXMLExtended extends SimpleXMLElement
{
public function addAttribute($name,$value,$namespace=null)
{
parent::addAttribute($name,$value,$namespace);
return $this;
}
}
?>
this behavior is similar to jQuery library.