Loop OBJECT and obtain both key and value

use get_object_vars ( object $object )

$vars = get_object_vars ( $object );
foreach($vars as $key=>$value) {
  var_dump($key);
  var_dump($value);
}

or just iterate the object itself

foreach($object as $key=>$value) {
  var_dump($key);
  var_dump($value);
}

-- edit 2

Here you'll have the keys and values in one line

$string = "";
foreach($regs as $object) {
  foreach($object as $key=>$value) {
    $string += "{$key}={$value} ";
  }
}
echo $string;

if this is not what you need, I'm clueless ..


You can loop through object properties with foreach

foreach($array as $key => $object)
    foreach($object as $property => $value)
        echo "{$property} : $value" . PHP_EOL;