获取数组的所有值并设置为变量

I have an array:

$groups = BP_Groups_Member::get_group_ids( $user_id );  
echo "<pre>";
var_dump($groups);
echo "</pre>";  

with gives the following result:

array(2) {
 ["groups"]=>
  array(2) {
  [0]=>
   string(1) "6"
  [1]=>
   string(1) "5"
  }
["total"]=>
int(2)
}

How can I get the strings "6" and "5" to set the company_id instead of "4"? In the example: First, it should show all avatars, links of users of the company "6" and after this in the same list, users of the company "5"

<?php if ( company_has_users('company_id=4 & exclude_admins_mods=false') ) : ?>

<ul id="user-list" class="item-list">
<?php while ( company_users() ) : company_the_user(); ?>

<li>
  <?php company_user_avatar() ?>
  <?php company_user_link() ?>
</li>
<?php endwhile; ?>
</ul>

<?php else: ?>

<div id="message" class="info">
  <p>This company has no users.</p>
</div>

check this example

<?php
$array  = array(
"0"=>array(
"01"=>"test1",
"02"=>"test2"
)
,1=>"xyz");
echo "<pre>";
print_r($array);

foreach($array as $data)
{
// this will print each element of array
    print_r($data);

}

//output will be

/*Array
(
    [01] => test1
    [02] => test2
)
xyz*/

?>