faqts : Computers : Programming : Languages : PHP : Function Libraries : System

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

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

Entry

Is there a way to use the include() function, with a variable path?

Apr 1st, 2000 07:30
Paul Gumerman, Data Wizard,


Yes, any of the following will work:

$incfile = '/data/sites/www/php/file1.inc';
include($incfile);

or

$language = 'english';
include("/data/sites/$language/php/file2.inc");

Note the use of double quotes above ... if you use single quotes, it 
won't parse the string.