What are the differences between "require" and "include" in PHP and how do they affect the program's execution?

The main differences between "require" and "include" in PHP are that "require" will cause a fatal error and stop the script execution if the file being included is not found, while "include" will only produce a warning and allow the script to continue. It is generally recommended to use "require" when the included file is crucial for the script to run properly, and "include" when the file is optional.

<?php
// Using require to include a crucial file
require 'header.php';

// Using include to include an optional file
include 'footer.php';
?>