a) because many people refuse to read manuals.
b) A real-world example. Of the difference between include() and require() because the difference is unclear... hmm.. oh well..
first
logon.php:
<?
echo "logon";
?>
logout.php:
<?
echo "logout";
?>
main:
<?
if ($action=="logon")
{
include("logon.php");
}
if ($action=="logout")
{
include("logout.php");
}
?>
second
user_lib.php:
<?
function user_lib_logon()
{
echo "logon";
}
function user_lib_logout()
{
echo "logout";
}
?>
main:
<?
require("user_lib.php");
if ($action=="logon")
{
user_lib_logon();
}
if ($action=="logout")
{
user_lib_logout();
}
in the first, the include() file is only read if action==logon or action==logout
in the second, it's allways read, even if action=="hello".
So if your user_lib is 200k, require() will allways read the 200k of code, even if it is never used, where include() will only read it if and when the include() is executed.