I am a little brain-dead after trying to figure out the best approach to accomplish what I am needing in my PHP script. I figure a fresh set of eyes would be of help ... any help is greatly appreciated.
I have a regular HTML document that I am reading the contents into a PHP script. I need to fetch several things out of the document and put them in different arrays.
In the HTML document are custom tags, for example:
<tag name="tagid" item="value" item2="value">Text or other content here</tag>
What I need to accomplish with this script is to grab all instances of "tag" and put it in an array. So, in the end the above snipped from my HTML document would end up being this:
tag[0] = "Text or other contents here"
I also need to grab all the attributes from the tag (eg name, item, item2, etc) and place them in the same variable, so:
tag[0] = "Text or other contents here"
tag[0name] = "tagid"
tag[0item] = "value"
tag[0item2] = "value"
The only problem is that each of the tags have different variables in them. I thought to use a combination of eregi and explode with some sort of pattern matching equation ... but I can't for the life of me figure it out.
Any help would be very greatly appreciated. You don't have to provide complete code to accomplish what I need ... just a push in the right direction would help 🙂
Thanks a bunch!