Are there any best practices for utilizing the "->" operator in PHP code?

When using the "->" operator in PHP code to access object properties or methods, it is important to ensure that the object being accessed is not null or undefined. This can be done by checking if the object is set before attempting to use the "->" operator.

// Check if the object is set before accessing its property
if(isset($object)){
    $value = $object->property;
    // Do something with $value
} else {
    // Handle the case when $object is not set
}