To check if something exits, you can use the PHP function isset() see php.net. This function will check if the variable is set and is not NULL.
Example:
if(isset($obj->a))
{
//do something
}
If you need to check if a property exists in a class, then you can use the build in function property_exists()
Example:
if (property_exists('class', $property)) {
//do something
}