note 71228 added to function.xml-parse-into-struct
| From: | tsivert at osu1 dot php dot net | Date: | Fri, 17 Nov 2006 11:06:33 +0000 |
| Subject: | note 71228 added to function.xml-parse-into-struct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119834@lists.php.net to get a copy of this message | ||
To John.
The reason that you only get the last item is that you declare a array of one element that is
constantly overwritten by the last element...
I don't know if you want to put the items as two different childarrays of the parent or if you
want to put the items in one childarray with two elements.
To put the items in two different childarrays, change the line
$php_stmt .= '[$level['.$start_level.']]';
to
$php_stmt .= '[$level['.$start_level.']][]';
To put in same childarray change line
$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
to
$php_stmt .= '[$xml_elem[\'tag\']][] = $xml_elem[\'value\'];';
Hope this helps you!
tsivert
----
Server IP: 83.137.200.2
Probable Submitter: 193.90.5.74
----
Manual Page -- http://www.php.net/manual/en/function.xml-parse-into-struct.php
Edit -- https://master.php.net/note/edit/71228
Del: integrated -- https://master.php.net/note/delete/71228/integrated
Del: useless -- https://master.php.net/note/delete/71228/useless
Del: bad code -- https://master.php.net/note/delete/71228/bad+code
Del: spam -- https://master.php.net/note/delete/71228/spam
Del: non-english -- https://master.php.net/note/delete/71228/non-english
Del: in docs -- https://master.php.net/note/delete/71228/in+docs
Del: other reasons-- https://master.php.net/note/delete/71228
Reject -- https://master.php.net/note/reject/71228
Search -- https://master.php.net/manage/user-notes.php