Just to note:
Though objects may (or may not) be Traversable, the can use in foreach because implicit conversion to array
<?php
class Foo {
    public $a = 1;
    public $b = "Helo";
};
$bar = new Foo;
foreach($bar as $elm) {
    echo $elm . ' ';
}
?> 
prints 1 Hello
Even
<?php
$bar = new stdClass
foreach($bar as $elm) {
    echo $elm . ' ';
}
?>
is correct.