title: PHP Print Multiple Values From An Array With A Wildcard
body: <p>I am trying to print multiple values, through PHP, from an array that includes a wildcard. I have managed to work out the wildcard element from another question on here, but I am now struggling to print multiple vales from multiple entities. I'm working from (12271 stdClass Object is the wildcard and the first stdClass Object is $order):</p>
  
  <pre><code>stdClass Object
  (
    [products]
      (
        [12271] =&gt; stdClass Object
          (
            [model] =&gt; MODEL1
            [qty] =&gt; 1
          )
  </code></pre>
  
  <p>So the code below works and prints out, correctly, 'MODEL1 1x'</p>
  
  <pre><code>&lt;?php
  $model = current((array)$order-&gt;products)-&gt;model;
  $qty = current((array)$order-&gt;products)-&gt;qty;
  print $model.' '.$qty.'x';
  ?&gt;
  </code></pre>
  
  <p>However, if multiple objects are present, such as</p>
  
  <pre><code>stdClass Object
  (
    [products]
      (
        [12271] =&gt; stdClass Object
          (
            [model] =&gt; MODEL1
            [qty] =&gt; 1
          )
        [45897] =&gt; stdClass Object
          (
            [model] =&gt; MODEL2
            [qty] =&gt; 2
  </code></pre>
  
  <p>I don't know how to print multiple objects so that it prints out:</p>
  
  <p>'MODEL1 1x' and 'MODEL2 2x'</p>
  
  <p>Any help would be much appreciated. For reference, I am trying to print out values from an Ubercart order in Drupal 7. Thanks</p>