note 92619 deleted from function.file-exists by googleguy

From: Date: Tue, 22 Oct 2013 11:15:02 +0000
Subject: note 92619 deleted from function.file-exists by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197037@lists.php.net to get a copy of this message
Note Submitter: plsnhat at gmail dot com ---- Since file_exists does not offer a possibility to search in include_path.. <?php /* * 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;} } ?>

« previous php.notes (#197037) next »