>Which is the main difference between include() and
>require() functions?


"include" is optional
you can put it inside an "IF"
like this:

if (0)
   {
   /* THIS WILL NOT SHOW... */
   include "optional_file.php";
   }


but "require" happens every time,
even if it is inside an "IF" that does not happen.

if (0)
   {
   /* THIS WILL SHOW ANYWAY... */
   require "optional_file.php";
   }


Me personally,
I use "require" to include functions, libraries, classes that I NEED to run 
the page.
Then I use "include" for optional things, based on "if".


<?
require "functions.inc";

if ($sunny_day)
   {
   include "sunny_day_message.txt";
   }

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to