Jump to content

Object Question


ainoy31

Recommended Posts

Hello-

 

I call a web service and this what is returned to me.

 

s

calling code: $result = $test->getPhoneNumber($objAccount);

tdClass Object
(
    [out] => stdClass Object
        (
        )

)

 

My understanding is that it is empty and I need to check to see if it is empty.  So, I use the following code to do so but no luck.

 


if(empty($result->out))
{
     do something....
}
else
{
      do something....
}

 

Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/115319-object-question/
Share on other sites

As of PHP 5, objects with no properties are no longer considered empty.

 

Do you know what this call returns when it is successfull?

 

If it is some other object type other than stdClass you could use...

 

if ($result instanceof stdClass) {
  // do something
} else {
  // do somthing else
}

Link to comment
https://forums.phpfreaks.com/topic/115319-object-question/#findComment-592878
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.