|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-05-07 21:09 UTC] crashyn at op dot pl
Description: ------------ --- From manual page: http://www.php.net/simplexmlelement.addchild --- addChild treats <my_string> as a tag nd removes it completely PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
<?php $xml_header = "<?xml version='1.0' encoding='utf-8'?><xml/>"; $xml = new SimpleXMLElement($xml_header); $xml->addChild("first_string","this is <mystring>"); $xml->addChild("second_string","this is < mystring>"); $xml->asXML("test.xml"); echo "<pre>" . $xml->first_string . "<br />"; // 'this is ' echo $xml->second_string . "</pre>"; // 'this is < mystring>' ?>