In what situations should include() be used instead of require() in PHP code?

include() should be used instead of require() in PHP code when the file being included is not crucial for the script to continue running. If the included file is not found, include() will only produce a warning and allow the script to continue, whereas require() will produce a fatal error and stop the script execution.

// Using include() to include a file that is not crucial for the script
include('optional_file.php');