title: pass values from a function to another function in controller
body: <p>i have 2 functions in a controller, </p>
  
  <pre><code>function feed()
  {
      $xml = simplexml_load_file('http://localhost/feed.php');
  
      // pass to other function
      $this-&gt;purchased($xml-&gt;prices);
  
      foreach ($xml-&gt;prices as $price) {
  
          echo ' &lt;tr id="'.$price-&gt;sign.'"&gt;&lt;td class="price"&gt;'.$price-&gt;wholesale.'&lt;/td&gt;';
      }
  }
  </code></pre>
  
  <p>in the above function i take some values from a feed and append it to a html in the front end using jquery</p>
  
  <p>in the below function what i do is list down all the products purchased by a particular user. this function also refreshed every 5 seconds.</p>
  
  <pre><code>function purchased($price)
  {
      foreach ($price as $x)
      {
          $retail = $x-&gt;retail;
      }
  }
  </code></pre>
  
  <p>what i need to do is get the values returned form the <code>function feed()</code> to the purchased function to do some calculations .. but when i use the above method i get the bellow error</p>
  
  <blockquote>
    <p>Message: Undefined variable: price</p>
    
    <p>Message: Missing argument 1 for Actions::purchased()</p>
  </blockquote>
  
  <p>can someone tell me how can i get the <code>prices</code> from the <code>feed</code> function and use it with the <code>purchased</code> function?</p>