note 103224 modified in function.set-include-path by danbrown

From: Date: Fri, 01 Apr 2011 19:18:05 +0000
Subject: note 103224 modified in function.set-include-path by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178420@lists.php.net to get a copy of this message
include_path is not taking in consideration by very commonly used functions such as file_exists(), the following hack can come handy to override that <?php function suchFile($file) // like file_exists() but takes in consideration include_path { if(!file_exists($file)) { $paths=explode(PATH_SEPARATOR,get_include_path()); foreach($paths as $p) if(file_exists(preg_replace('%/$%','',$p)."/$file")) return true; return false; } else return true; } ?> --was-- include_path is not taking in consideration by very commonly used functions such as file_exists(), the following hack can come handy to override that <?php function suchFile($file) // like file_exists() but takes in consideration include_path { if(!file_exists($file)) { $paths=explode(PATH_SEPARATOR,get_include_path()); foreach($paths as $p) if(file_exists(preg_replace('%/$%','',$p)."/$file")) return true; return false; } else return true; } http://php.net/manual/en/function.set-include-path.php

« previous php.notes (#178420) next »