How can require be used as an alternative to include in PHP?

When including a file in PHP using the include function, if the file is not found, a warning is issued and the script continues to execute. To avoid this issue and ensure that the file is found and included successfully, you can use the require function instead. Require will cause a fatal error if the file is not found, halting the script execution.

<?php
require 'myfile.php';
?>