include and require simply generate different errors and depending on your php settings php will handle that error differently. For example, if you were to include/require a file that does not exist: Include will allow the script to continue, generating a warning error. Require will halt and generate a fatal error, disallowing the script to continue, hence the name require, meaning the script cannot run without the required file.
"Require" ensures that the file is included. Hence, by using "require" the parser checks that the files are always included. This is not the case with "include" and it may be avoided.
Require gives you a fatal error in php if your file isn't found, include gives you a warning. Require is also more CPU intensive.
you also have include_once and require_once I recommend you get familiar with www.php.net which is reliable and instant for simple explanations like this.
From PHP manual : require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don’t hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. I think its enough information to resolve your question.
In my opinion, you should ALWAYS use require(). If you want a file to be present inside another file, you want it to either work or not work. It's like having this: File 'includeme.php': $variable='my variable'; PHP: File 'index.php': include('includeme.php');echo $variable; PHP: You may look at this and see nothing wrong. However, if includeme.php fails to include properly, like the file has moved or it's permissions are weird, index.php won't display 'my variable' as it should. require(); will exit() the script with a fatal error, which is better than having a faulty webpage. At least the error will tell you what happened. You can try this for yourself by setting error_reporting to E_ALL (like this error_reporting(E_ALL); //That's all you need PHP: PHP will generate notices if a variable isn't found, so with E_ALL on, this script will return a notice of $var not found echo $var; //But where is $var? PHP: helping you seek out the issue.