What is the difference between include and require in PHP?

The main difference between include and require in PHP is how they handle errors. If the file being included is not found, include will only produce a warning and continue executing the script, while require will produce a fatal error and stop the script execution. It is generally recommended to use require when including essential files that are necessary for the script to run properly.

// Using require to include a file
require 'myfile.php';