Re: Dynamic array creation and tracking
| From: | tedd | Date: | Tue, 06 Oct 2009 17:11:42 +0000 |
| Subject: | Re: Dynamic array creation and tracking | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298667@lists.php.net to get a copy of this message | ||
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:Hi John: 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: http://www.php.net/xml and more specifically: http://www.php.net/manual/en/example.xml-structure.php 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. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com