You are here: Re: Is there a php function that dumps an array to a XML file? « PHP Programming Language « IT news, forums, messages
Re: Is there a php function that dumps an array to a XML file?

Posted by ZeldorBlat on 04/16/07 13:27

On Apr 16, 6:32 am, Man-wai Chang <toylet.toy...@gmail.com> wrote:
> --
> iTech Consulting Services Limited
> Expert of ePOS solutions
> Website:http://www.itech.com.hk(IE only)
> Tel: (852)2325 3883 Fax: (852)2325 8288

This is untested. The element names will be the array's keys, and the
values will be the values. If the value is an array it will turn that
into XML and stick it inside the element.

function arrayToXML($a) {
$xml = '';

foreach($a as $k => $val)
$xml .= "<$k>" . (is_array($val) ? arrayToXML($val) : $val) .
"</$k>";

return $xml;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация