How to iterate through a nested stdClass? [duplicate]

echo "<table>"

foreach ($object->values as $arr) {
    foreach ($arr as $obj) {
        $id   = $obj->group->id;
        $name = $obj->group->name;

        $html  = "<tr>";
        $html .=    "<td>Name : $name</td>";
        $html .=    "<td>Id   : $id</td>";
        $html .= "</tr>";
    }
}

echo "</table>";

Leave a Comment