note 36260 deleted from function.include by didou
| From: | didou@php.net | Date: | Thu, 02 Oct 2003 15:51:45 +0000 |
| Subject: | note 36260 deleted from function.include by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57621@lists.php.net to get a copy of this message | ||
Note Submitter: deejaydash@uboot.com
----
If you want to include lots of files, you can use this little code, instead of typing hundreds of
lines with the same command. It also checks, if the file exists and returns an error message, if
only one of the files can't be found.
<?php
$inc_files=array("file1.inc.php","../file2.inc.php"); //ARRAY WITH FILES TO
INCLUDE
for($i=0;$i<sizeof($inc_files);$i++) {
if(file_exists($inc_files[$i])) { include_once($inc_files[$i]); } else { die("File not
found: <B>$inc_files[$i]</B>"); }
}
?>
greets,
deejaydash