title: stdClass object and foreach loops
body: <p>I am using the following code to get data from a website using Soap. </p>
  
  <pre><code>$client = new SoapClient('http://some.url.here');
  class SMSParam {
      public $CellNumber;
      public $AccountKey;
      public $MessageCount;
      public $MessageBody;
      public $Reference;
  
  }
  $parameters = new SMSParam;
  $parameters -&gt; AccountKey = "$sms_key";
  $parameters -&gt; MessageCount = "25";
  $Result = $client-&gt;GetIncomingMessages($parameters);
  echo "&lt;pre&gt;";
  print_r($Result);
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>Here is a sample of the output:</p>
  
  <pre><code>stdClass Object
  (
      [GetIncomingMessagesResult] =&gt; stdClass Object
          (
              [SMSIncomingMessage] =&gt; Array
                  (
                      [0] =&gt; stdClass Object
                          (
                              [OutgoingMessageID] =&gt; data
                              [Reference] =&gt; data
                              [MessageNumber] =&gt; data
                              [PhoneNumber] =&gt; data
                              [Message] =&gt; data
                              [ReceivedDate] =&gt; data
                          )
  
                      [1] =&gt; stdClass Object
                          (
                              [OutgoingMessageID] =&gt; data
                              [Reference] =&gt; data
                              [MessageNumber] =&gt; data
                              [PhoneNumber] =&gt; data
                              [Message] =&gt; data
                              [ReceivedDate] =&gt; data
                          )
  
                      [2] =&gt; stdClass Object
                          (
                              [OutgoingMessageID] =&gt; data
                              [Reference] =&gt; data
                              [MessageNumber] =&gt; data
                              [PhoneNumber] =&gt; data
                              [Message] =&gt; data
                              [ReceivedDate] =&gt; data
                          )
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p>If only 1 result is returned, I can simply do something like this:</p>
  
  <pre><code>$reference = $result-&gt;GetIncomingMessagesResult-&gt;SMSIncomingMessage-&gt;Reference;
  </code></pre>
  
  <p>So how would I go about working with multiple results?</p>
  
  <p>Any help would be greatly appreciated.</p>