require and include

Hello comrades! I understand that the question is repeated, but it is still relevant!

The official PHP resource does not say in the description of the require function that it includes the specified files BEFORE the handler starts working, on the contrary, there is no significant difference between require and include.

Earlier, I remember how it was said that require includes files BEFORE the handler starts working, without paying attention to the position of this function and whether it will be executed by the condition or not. It was used accordingly to include the necessary files, but it was faster than include because it did its job BEFORE the handler started working.

And include is good because it can dynamically connect files, for example, in a loop, and if there is no file, it will not stop the script, but only cause a warning.

Actually, the question is: As a fairly serious PHP programmer, I need help with these for example, I need to speed up my scripts, tell us about these functions, how do they work in PHP5?

Here is one of the experiments:

<?php
echo (function_exists('_tools_configurations')) ? 'ok': 'no';
require('./system/tools/_/_tools_configurations/_tools_configurations.php');
?>
Author: Андрей Аршинов, 2012-11-09

1 answers

Practice shows that require running faster but he collects the plug-in files at the beginning of the script, and include mounts on the go this logic follows that if you have the conditions for connection file, use include if there are some conditions require well, looks different display error messages (if the file is not available) require more stringent in this case.

(c) some old site that used to crawl

 4
Author: Artem, 2012-11-09 05:31:02