How does include() and require() handle errors differently in PHP?

include() and require() handle errors differently in PHP. include() will only produce a warning (E_WARNING) and continue executing the script if the file being included is not found. On the other hand, require() will produce a fatal error (E_COMPILE_ERROR) and stop the script execution if the file being required is not found. If the file being included or required is critical for the script to run, it is recommended to use require() to ensure that the script stops if the file is not found.

// Using require() to handle errors
require('file.php');