What is the role of isset() in handling non-existent properties in PHP?

When accessing non-existent properties in PHP, an error may be thrown. To handle this issue, the isset() function can be used to check if a property exists before trying to access it. This helps prevent errors and allows for more controlled handling of non-existent properties.

// Check if the property exists before accessing it
if(isset($object->nonExistentProperty)) {
    // Access the property if it exists
    $value = $object->nonExistentProperty;
    echo $value;
} else {
    // Handle the case where the property does not exist
    echo "Property does not exist";
}