note 92619 added to function.file-exists
| From: | plsnhat at gmail dot com | Date: | Fri, 31 Jul 2009 14:30:29 +0000 |
| Subject: | note 92619 added to function.file-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158965@lists.php.net to get a copy of this message | ||
Since file_exists does not offer a possibility to search in include_path..
/*
* Expanden file_exists function
* Searches in include_path
*/
function file_exists_ip($filename) {
if(function_exists("get_include_path")) {
$include_path = get_include_path();
} elseif(false !== ($ip = ini_get("include_path"))) {
$include_path = $ip;
} else {return false;}
if(false !== strpos($include_path, PATH_SEPARATOR)) {
if(false !== ($temp = explode(PATH_SEPARATOR, $include_path)) && count($temp) > 0) {
for($n = 0; $n < count($temp); $n++) {
if(false !== @file_exists($temp[$n] . $filename)) {
return true;
}
}
return false;
} else {return false;}
} elseif(!empty($include_path)) {
if(false !== @file_exists($include_path)) {
return true;
} else {return false;}
} else {return false;}
}
----
Server IP: 217.160.72.57
Probable Submitter: 92.79.150.174
----
Manual Page -- http://www.php.net/manual/en/function.file-exists.php
Edit -- https://master.php.net/note/edit/92619
Del: integrated -- https://master.php.net/note/delete/92619/integrated
Del: useless -- https://master.php.net/note/delete/92619/useless
Del: bad code -- https://master.php.net/note/delete/92619/bad+code
Del: spam -- https://master.php.net/note/delete/92619/spam
Del: non-english -- https://master.php.net/note/delete/92619/non-english
Del: in docs -- https://master.php.net/note/delete/92619/in+docs
Del: other reasons-- https://master.php.net/note/delete/92619
Reject -- https://master.php.net/note/reject/92619
Search -- https://master.php.net/manage/user-notes.php