note 97429 deleted from ref.xmlwriter by danbrown
| From: | danbrown@php.net | Date: | Mon, 19 Apr 2010 15:21:10 +0000 |
| Subject: | note 97429 deleted from ref.xmlwriter by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168418@lists.php.net to get a copy of this message | ||
Note Submitter: benstendahl at hotmail /./ com
----
Update to massimo71
Changed the fromArray method to ignore properly used numeric indexes in arrays to differentiate
between same name associative keys that are not allowed nor necessary for XML strings/files.
<?php
public function fromArray($xAry){
if(is_array($xAry)){
foreach ($xAry as $key=>$val){
if (is_numeric($key)){
$this->fromArray($val);
}
else if(is_array($val)){
$this->startElement($key);
$this->fromArray($val);
$this->endElement();
}
else
$this->writeElement($key, $val);
}
}
else {
return FALSE;
}
}
?>