moving companies : Computers : Programming : Languages : PHP : kms : General

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 4 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

Entry

Why does require($file_name) in a loop just include the first file repeatedly?

Jan 24th, 2000 19:43
Nathan Wallace, Matt Gregory,


If you want to include files within a loop you need to use include:
    http://www.php.net/manual/function.include.php3
The difference is that include is done at run time, not parse time. 
When you use require the file is injected straight into the code when it
is being parsed, so only the first file name will be used many times.  
You can read more about the difference between include() and require()
here:
    http://www.faqts.com/knowledge-base/view.phtml/aid/6/fid/40