What role does the isset function play in checking for returned results in PHP?

When working with PHP, it is common to check if a variable has been set or not before using it to prevent potential errors. The isset function is used to determine if a variable is set and is not NULL. This is particularly useful when dealing with form submissions or database queries where a variable may or may not have a value.

// Check if the variable $result is set before using it
if(isset($result)) {
    // Process the result
    echo $result;
} else {
    // Handle the case where $result is not set
    echo "No result found";
}