Php function request
| From: | mike | Date: | Fri, 30 Dec 2005 02:30:09 +0000 |
| Subject: | Php function request | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30206@lists.php.net to get a copy of this message | ||
Dear php.net,
I love php and am a keen developer in your language which I find
handles most of my scripting want. But could I please request a few
new functions to be added in a near future release:
- A nice simple standalone function that with out to convert XML/HTML
data into a dynamic array with a nice short name e.g. xml2array or
something that would look like this:
xml2array(xmlstring [,returnedarrayname])
and it would work like this:
<?php
$xml = "<name>bob</name><age>23</age><location>Wales, United
Kingdom</location><name>steve</name><age>35</age><location>Canada</location>
<name>simon</name><age>18</age><location>Washington DC, United States
of America</location>";
$xmlarray = xml2array($xml);
print_r($xmlarray);
?>
which would return:
Array([name] => Array("bob", "steve", "simon") [age] =>
Array("23",
"35", "18") [location] => Array("Wales, United Kingdom",
"Canada",
"Washington DC, United States of America"));
I know php already has a 'library' of functions to do this. But it'd
be nice to have a simpler standalone function that doesnt require much
code and your unlikely to forget how to use it.
Also you could make a simmular xmlfile2array function to handle .xml
and .html files.
- A new library of patern matching function less complicated than
regex that allows you to do the same thing only with less hard to
remember syntax and that isnt so stressful to get right. I have been
having to use alot of character by characters while loops to do this
which takes a lot of time and code and space and bandwidth so this
sort of new library would really be appreciated.
- thanks mike.