note 127998 added to simplexmlelement.addattribute
| From: | caffeinatedbits at main dot php dot net | Date: | Fri, 09 Dec 2022 10:50:25 +0000 |
| Subject: | note 127998 added to simplexmlelement.addattribute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219954@lists.php.net to get a copy of this message | ||
Just found another gem. Need to remove an attribute? That's simple too!
<?php
$xml = <<<EOF
<?xml version="1.0" encoding="utf-8" ?>
<Animals>
<Dog breed="chihuahua"/>
</Animals>
EOF;
$animals = new SimpleXMLElement($xml);
echo $animals->Dog->asXML();
// <Dog breed="chihuahua"/>
unset($animals->Dog['breed']);
echo $animals->Dog->asXML();
// <Dog/>
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.175 (proxied: 144.129.235.105)
----
Manual Page -- https://php.net/manual/en/simplexmlelement.addattribute.php
Edit -- https://main.php.net/note/edit/127998
Del: integrated -- https://main.php.net/note/delete/127998/integrated
Del: useless -- https://main.php.net/note/delete/127998/useless
Del: bad code -- https://main.php.net/note/delete/127998/bad+code
Del: spam -- https://main.php.net/note/delete/127998/spam
Del: non-english -- https://main.php.net/note/delete/127998/non-english
Del: in docs -- https://main.php.net/note/delete/127998/in+docs
Del: other reasons-- https://main.php.net/note/delete/127998
Reject -- https://main.php.net/note/reject/127998
Search -- https://main.php.net/manage/user-notes.php