Through the process of a script I have written I end up with a string which is a HTML/XML style tag, eg.
<mycustomtag attr="blah" attr2="blah">
I was wondering if there is any shortcut to parsing this tag into possibly a named array or an object with any attributes that exist in the tag. Such that $mycustomtag->attr == "blah", or something similar.
I thought of using the XML functions (by appending </mycustomtag> onto the end, etc.etc.) but I don't understand that section really 🙂
Barring that, does anyone have (or could write) a script that could do the above? Note that the amount and names of attributes are not fixed, but the tag name and attributes are always lowercase and the values are always enclosed in quotes.
TIA.