foreach: how to iterate this

Posted by ilnur777 on Stack Overflow See other posts from Stack Overflow or by ilnur777
Published on 2010-03-30T08:32:17Z Indexed on 2010/03/30 8:33 UTC
Read the original article Hit count: 253

Filed under:
|
|
object(stdClass)[1] 
  public 'inbox' =>  
    array 
      0 =>  
        object(stdClass)[2] 
          public 'from' => string '55512351' (length=8) 
          public 'date' => string '29/03/2010' (length=10) 
          public 'time' => string '21:24:10' (length=8) 
          public 'utcOffsetSeconds' => int 3600 
          public 'recipients' =>  
            array 
              0 =>  
                object(stdClass)[3] 
                  public 'address' => string '55512351' (length=8) 
                  public 'name' => string '55512351' (length=8) 
                  public 'deliveryStatus' => string 'notRequested' (length=12) 
          public 'body' => string 'This is message text.' (length=21) 
      1 =>  
        object(stdClass)[4] 
          public 'from' => string '55512351' (length=8) 
          public 'date' => string '29/03/2010' (length=10) 
          public 'time' => string '21:24:12' (length=8) 
          public 'utcOffsetSeconds' => int 3600 
          public 'recipients' =>  
            array 
              0 =>  
                object(stdClass)[5] 
                  public 'address' => string '55512351' (length=8) 
                  public 'name' => string '55512351' (length=8) 
                  public 'deliveryStatus' => string 'notRequested' (length=12) 
          public 'body' => string 'This is message text.' (length=21) 
      .... 
      .... 

I have this foreach, but it does not iterate address, name, deliveryStatus! Could you show how to get this data?

foreach ($data->inbox as $note) {
  echo '<p>';
  echo 'From : ' . htmlspecialchars($note->from) . '<br />';
  echo 'Date : ' . htmlspecialchars($note->date) . '<br />';
  echo 'Time : ' . htmlspecialchars($note->time) . '<br />';
  echo 'Body : ' . htmlspecialchars($note->body) . '<br />';
}

© Stack Overflow or respective owner

Related posts about foreach

Related posts about arrays