How can one effectively handle errors that may arise when using require() and include() in PHP?

When using require() and include() in PHP, it is important to handle errors that may arise if the file being included is not found or cannot be accessed. One way to effectively handle these errors is by using the include_once() and require_once() functions, which will include the file only once and prevent any potential issues with redeclaration of functions or classes.

// Using require_once() to include a file and handle errors
require_once('file.php');