On Fri, 27 Aug 2004 12:16:32 +0200, Jay <[EMAIL PROTECTED]> wrote: > Hi! > > Is there a ready to use PHP function for including ONLY if the file exists? > > I tried it like this: > > [main.php] > include_once("lib.php"); > .....later > includeIf("somefile.php"); > > [lib.php] > function includeIf($filename) > { > if (!file_exists($filename)) > { > include_once($filename); > } > }
you sure you dont mean this? function includeIf($filename) { if (file_exists($filename)) /*instead of if (!file_exists($filename))*/ { include_once($filename); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php