I have the following class:
class Usuario{
private $nome;
private $profissao;
function setNome($nome){
$this->nome = $nome;
}
function getNome(){
return $this->nome;
}
function setProfissao($profissao){
$this->profissao = $profissao;
}
function getProfissao(){
return $this->profissao;
}
}
Here I instantiate an object
$user = new Usuario();
$user->setNome('Nome Qualquer');
$user->setProfissao('Profissão Qualquer');
I wanted to know how I can list all the properties of this object using foreach . I already know there is get_object_vars
that already does this for me. But I wanted to use the same foreach for this purpose. Of course the above example is just a simple example.