-2
I made the function down to pass by one Object of PHP class for a array, also PHP.
 /* Converte um objeto em array() */
  public function ObjToArray ($_obj) {
    $array = null;
    print_r( $_obj ); //funciona normalmente, imprime o objeto
    foreach ($_obj as $key => $value) :
       print "Key: " . $key . " VALUE: " .$value."<br>"; //não imprime, não entra aqui.
       $array [$key] = $value;
    endforeach;
    return $array;
  } 
The print_r( $_obj ) works normally. 
But it doesn’t enter the foreach.
Where will be the mistake?
It would not be simpler to convert the object using a Typecast?
– gato
give an example of Typecast? Making the conversion in the class itself?
– Carlos Rocha
It would be something like that
$meuArray = (array) $meuObjeto;.– gato