Page 1 of 1

PHP Includes

Posted: Sat Jun 28, 2008 12:23 pm
by mikailgarcia
Guys, please bear with me as i am a newbie on PHP.

I would like to know how php include works... assuming you have an include statement inside a series of if and switch statements, will all the included php/txt/htmls be loaded on runtime or does the control structure be validated first before the file is included?

thanks.

- miko

Re: PHP Includes

Posted: Sat Jun 28, 2008 12:28 pm
by Bill H
The include file will be loaded only if the "if" clause is validated

Code: Select all

 
include "this.inc"
 
if (true)
{
     include "that.inc";
}
if (false)
{
     include "not.inc";
}
 
"this.inc" will always load, "that.inc" will, "not.inc" will not.

Re: PHP Includes

Posted: Sun Jun 29, 2008 2:50 am
by mikailgarcia
thanks.