So here's the deal. I'm pulling some nice xml out of a DB, and storing it in a variable. I then want to use regex to break it apart. This is what it will look like... //in the DB, <workplace> <name>...</name> <years>...</years> </workplace> <workplace> ... </workplace> etc. $xml = mysql_query(...irrelevant...); PHP: Now I really suck with regex, and I'm not sure how to go about this. Basically, I want to be left with an associative array like so... $array = array(1 => array('name' => '...', 'years' => '...'), 2 => etc...); PHP: How can I go about this, a point in the right direction would be perfectly fine.
Why not use SimpleXML? Does pretty much what you want. Except you get the results in a object, rather than an array. www.php.net/simplexml_load_string