如何检查对象属性类型?

Sorry for the title, I couldn't find a better way to write it =/

I am receiving a error object called ErrorBase.

If there is only one error it will return me the following:

public 'ErrorBase' => 
      public 'CODIGO_ERRO' => string '1' (length=1)
      public 'MENSAGEM_ERRO' => string 'Autenticação Inválida' (length=24)
      public 'TIPO_ERRO' => string 'Usuario' (length=7)

But if there is more than one error, it will return me a array of objects like this:

public 'ErrorBase' => 
array
  0 => 
    object(stdClass)[30]
      public 'CODIGO_ERRO' => string '1' (length=1)
      public 'MENSAGEM_ERRO' => string 'Autenticação Inválida' (length=24)
      public 'TIPO_ERRO' => string 'Usuario' (length=7)
  1 => 
    object(stdClass)[31]
      public 'CODIGO_ERRO' => string '002' (length=3)
      public 'MENSAGEM_ERRO' => string 'teste 002' (length=9)
      public 'TIPO_ERRO' => string 'tipo 002' (length=8)
  2 => 
    object(stdClass)[32]
      public 'CODIGO_ERRO' => string '003' (length=3)
      public 'MENSAGEM_ERRO' => string 'teste 003' (length=9)
      public 'TIPO_ERRO' => string 'tipo 003' (length=8)
  3 => 
    object(stdClass)[33]
      public 'CODIGO_ERRO' => string '004' (length=3)
      public 'MENSAGEM_ERRO' => string 'teste 004' (length=9)
      public 'TIPO_ERRO' => string 'tipo 004' (length=8)

How can I work with these situations? How do I check if there is a array of objects or only a object?

Thanks in advance for any help.

Use is_array() :

if (is_array($this->ERROR_BASE))

Try...

is_object() and is_array()

is_array($variable) returns true if $variable contains an array, and false otherwise.

To test the class of an object :

if ($var instanceof ErrorBase) {

To test if it is an array :

if (is_array($var)) {

use gettype() to returns the vars type.

or use is_array/is_object to test for each