Skip to content
Snippets Groups Projects
Commit e2725621 authored by Peter Rotich's avatar Peter Rotich
Browse files

Put elements of the same type into an array

parent 6217203c
No related branches found
No related tags found
No related merge requests found
......@@ -77,10 +77,14 @@ class XmlDataParser {
$this->content = array_pop($this->stack);
$i = 1;
if (array_key_exists($name, $this->content)) {
while (array_key_exists("$name$i", $this->content)) $i++;
$name = "$name$i";
}
$this->content[$name] = $prev;
if(!isset($this->content[$name][0])) {
$current = $this->content[$name];
unset($this->content[$name]);
$this->content[$name][0] = $current;
}
$this->content[$name][] = $prev;
} else
$this->content[$name] = $prev;
}
function content($parser, $data) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment