title: Php simplexml find/replace between two xml documents
body: <p>First question posted here.  I've tried to research this but either I'm not defining my question properly or I'm missing something obvious, so I'm bringing this to the group brain.</p>
  
  <p>I'm writing a web app for a non-profit theatre I work for, using PHP.  In this app, I use SimpleXML to pull down two XML documents from another location - one is a list of orders with price numbers, the other is a list of prices with price names.</p>
  
  <p>What I'm trying to do, as simply and elegantly as possible, is iterate through the order document, find each price number ("price_id", a seven-digit number), go to the other document which also has those seven-digit numbers as well as a corresponding price name (price_name, which is"regular", "senior", "group", "student", "passholder", etc), and either - whichever is simpler - replace the number in the first document with the name from the second, or add an element following the number which has the corresponding price name, so that each patron shows up in the order document with a human-understandable price name instead of just a seven digit number that makes our box office staff go "huh?"</p>
  
  <p>Psuedocode (from memory...):</p>
  
  <pre><code>    $orders = simplexml_get_file(https://the-url-of-the-xml-order-document);
      $prices = simplexml_get_file(https://the-url-of-the-xml-price-document);
      foreach($orders-&gt;item-&gt;price_id as $price)
       {
       //...here inlies my question, but what I'd like to do is...
      $price = $prices-&gt;item-&gt;(the price_name that corresponds to the price_id); 
      //...but I haven't found a simple way to do this, or really any way, 
      //based on my searches, but I know there has to be some way.
      }
  </code></pre>
  
  <p>Thank you!</p>