Posted by Lucian Daniliuc in
PHP,
XML on Oct 4th, 2008 |
No Comments
I’ve seen here the shortest xml2array implementation:
function xml2array($xml) {
$xmlary = array();
$reels = '/<(\w+)\s*([^\/>]*)\s*(?:\/>|>(.*)<\/\s*\\1\s*>)/s’;
$reattrs = ‘/(\w+)=(?:”|\’)([^"\']*)(:?”|\’)/’;
preg_match_all($reels, $xml,...