note 37739 deleted from function.domdocument-create-element by sobak
| From: | sobak@php.net | Date: | Fri, 25 Nov 2016 05:36:53 +0000 |
| Subject: | note 37739 deleted from function.domdocument-create-element by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207638@lists.php.net to get a copy of this message | ||
Note Submitter: dk
----
The first example on this page is also a bit verbose. Since the DomElement class inherits/extends
the DomNode class, one does not, in fact, have to get another reference to the first node. The
create_element method has already given you that reference. (Also, the last line passes a string to
the append_child method, instead of a DomNode object) Simplified:
<?
$new_element = $dom->create_element("new_element");
$new_element->append_child($another_element);
$oldTag->append_child($new_element);
?>