Are there any specific scenarios where it is recommended to always use function_exists and class_exists?

When working with PHP code that relies on external functions or classes that may not always be available, it is recommended to use function_exists and class_exists to check for their existence before attempting to use them. This helps prevent fatal errors or unexpected behavior in cases where the required functions or classes are not defined.

// Check if a function exists before calling it
if (function_exists('my_function')) {
    my_function();
}

// Check if a class exists before using it
if (class_exists('MyClass')) {
    $object = new MyClass();
}