PHP Includes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikailgarcia
Forum Newbie
Posts: 2
Joined: Sat Jun 28, 2008 12:07 pm

PHP Includes

Post 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
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Re: PHP Includes

Post 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.
mikailgarcia
Forum Newbie
Posts: 2
Joined: Sat Jun 28, 2008 12:07 pm

Re: PHP Includes

Post by mikailgarcia »

thanks.
Post Reply