note 84187 added to function.xml-parse-into-struct
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 02 Jul 2008 15:35:45 +0000 |
| Subject: | note 84187 added to function.xml-parse-into-struct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141074@lists.php.net to get a copy of this message | ||
@jemptymethod:
I found only one downfall to your function. If you have duplicates, the first one cannot be accessed
iteratively.
I added the following to fix the problem:
<?php
...
else if (is_array($parent['children'][$tag])) {
if(!isset($parent['children'][$tag][0])) {
$oldSingle = $parent['children'][$tag];
$parent['children'][$tag] = null;
$parent['children'][$tag][] = $oldSingle;
}
$parent['children'][$tag][] = $pop['children'];
}
...
?>
----
Server IP: 92.48.74.199
Probable Submitter: 86.54.205.90
----
Manual Page -- http://www.php.net/manual/en/function.xml-parse-into-struct.php
Edit -- https://master.php.net/note/edit/84187
Del: integrated -- https://master.php.net/note/delete/84187/integrated
Del: useless -- https://master.php.net/note/delete/84187/useless
Del: bad code -- https://master.php.net/note/delete/84187/bad+code
Del: spam -- https://master.php.net/note/delete/84187/spam
Del: non-english -- https://master.php.net/note/delete/84187/non-english
Del: in docs -- https://master.php.net/note/delete/84187/in+docs
Del: other reasons-- https://master.php.net/note/delete/84187
Reject -- https://master.php.net/note/reject/84187
Search -- https://master.php.net/manage/user-notes.php