note 101442 added to simplexmlelement.addattribute

From: Date: Thu, 16 Dec 2010 17:44:56 +0000
Subject: note 101442 added to simplexmlelement.addattribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-174997@lists.php.net to get a copy of this message
If the attribute already exists, addAttribute does nothing. example: <?php $xml_string = <<<XML <?xml version="1.0" encoding="UTF-8"?> <root> <item id="foo"> <root> XML; $xml = simplexml_load_string($xml_string); $xml->item->addAttribute('id', 'bar'); echo $xml->asXML(); ?> The above examples will output: <?xml version="1.0" encoding="UTF-8"?> <root> <item id="foo"> <root> ---- Server IP: 69.147.83.197 Probable Submitter: 151.48.98.14 ---- Manual Page -- http://www.php.net/manual/en/simplexmlelement.addattribute.php Edit -- https://master.php.net/note/edit/101442 Del: integrated -- https://master.php.net/note/delete/101442/integrated Del: useless -- https://master.php.net/note/delete/101442/useless Del: bad code -- https://master.php.net/note/delete/101442/bad+code Del: spam -- https://master.php.net/note/delete/101442/spam Del: non-english -- https://master.php.net/note/delete/101442/non-english Del: in docs -- https://master.php.net/note/delete/101442/in+docs Del: other reasons-- https://master.php.net/note/delete/101442 Reject -- https://master.php.net/note/reject/101442 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174997) next »