What potential pitfalls should be considered when using callbacks in PHP?

One potential pitfall when using callbacks in PHP is not properly handling errors or exceptions that may occur within the callback function. To mitigate this issue, it is important to wrap the callback function in a try-catch block to catch any potential errors and handle them appropriately.

try {
    $result = call_user_func($callback);
} catch (Exception $e) {
    // Handle the exception here
    echo 'An error occurred: ' . $e->getMessage();
}