note 77123 added to ref.simplexml

From: Date: Thu, 16 Aug 2007 09:10:57 +0000
Subject: note 77123 added to ref.simplexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-129517@lists.php.net to get a copy of this message
if you want to export an array as xml you can use this script <?php $test=array("TEST"=>"nurso", "none"=>null, "a"=>"b", array( "c"=>"d", array("d"=>"e"))); $xml=array_to_simplexml($test); print->($xml); print_r($xml->asXML()); function array_to_simplexml($array, $name="config" ,&$xml=null ) { if(is_null($xml)) { $xml = new SimpleXMLElement("<{$name}/>"); } foreach($array as $key => $value) { if(is_array($value)) { $xml->addChild($key); array_to_simplexml($value, $name, $xml->$key); } else { $xml->addChild($key, $value); } } return $xml; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 85.183.211.26 ---- Manual Page -- http://www.php.net/manual/en/ref.simplexml.php Edit -- https://master.php.net/note/edit/77123 Del: integrated -- https://master.php.net/note/delete/77123/integrated Del: useless -- https://master.php.net/note/delete/77123/useless Del: bad code -- https://master.php.net/note/delete/77123/bad+code Del: spam -- https://master.php.net/note/delete/77123/spam Del: non-english -- https://master.php.net/note/delete/77123/non-english Del: in docs -- https://master.php.net/note/delete/77123/in+docs Del: other reasons-- https://master.php.net/note/delete/77123 Reject -- https://master.php.net/note/reject/77123 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129517) next »