note 112610 added to example.xml-structure

From: Date: Thu, 04 Jul 2013 10:32:17 +0000
Subject: note 112610 added to example.xml-structure
Groups: php.notes 
Request: Send a blank email to php-notes+get-195454@lists.php.net to get a copy of this message
public static function xml2array($element, $arr = array()) { if(is_string($element)) { $element = (strlen($element) > 5 && substr($element, -4) === '.xml') ? simplexml_load_file(DATAPATH.$element) : simplexml_load_string($element); } $iter = 0; foreach($element->children() as $b) { $a = $b->getName(); if(!$b->children()){ $arr[$a] = trim($b[0]); } else{ $arr[$a][$iter] = array(); $arr[$a][$iter] = self::xml2array($b,$arr[$a][$iter]); } $iter++; } return $arr; } } ?> ---- Server IP: 46.252.156.25 Probable Submitter: 80.243.56.34 ---- Manual Page -- http://php.net/manual/en/example.xml-structure.php Edit -- https://master.php.net/note/edit/112610 Del: integrated -- https://master.php.net/note/delete/112610/integrated Del: useless -- https://master.php.net/note/delete/112610/useless Del: bad code -- https://master.php.net/note/delete/112610/bad+code Del: spam -- https://master.php.net/note/delete/112610/spam Del: non-english -- https://master.php.net/note/delete/112610/non-english Del: in docs -- https://master.php.net/note/delete/112610/in+docs Del: other reasons-- https://master.php.net/note/delete/112610 Reject -- https://master.php.net/note/reject/112610 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195454) next »