At 12:18 PM -0400 10/6/09, John Nichel wrote:
Howdy guys and girls. Been a long time since I've been in these parts.
My php is rusty these days, so please bare with me. I'm trying to
create a dynamic, multidimensional array, and keep track of which level
I'm on, opening and closing levels as needed. Lets say that I have some
data like the below:
Not that it matters, but I remember you. You left the list a couple
of years ago. But only after you publicly stated that you added me to
your kill file because I asked a question in a manner that you didn't
approve. Well, I hope those days are past -- we're usually bit more
understanding and less confrontational on this list now. The idea
here is to help -- so, welcome to the list.
What you are asking is much like parsing an xml file. I don't know
where you're getting your data, you didn't say other than you
mentioned "tags", but you might find this of help:
and more specifically:
That seems to mimic what you are trying to do.
As far as keeping track of what level you're on, there are several
Parser functions to explore such as byte_index, line_number, and
column_number. Perhaps those will help.
http://sperling.com http://ancientstones.com http://earthstones.com
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php