note 103295 deleted from function.get-included-files by danbrown
| From: | danbrown@php.net | Date: | Wed, 06 Apr 2011 13:42:53 +0000 |
| Subject: | note 103295 deleted from function.get-included-files by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178556@lists.php.net to get a copy of this message | ||
Note Submitter: Jonathon Hibbard
----
Unsing sam at consideropen dot com's removal of path information, here is a simple search
method for checking a file name either by ignoring all paths, or by passing a full path file name...
<?php
public static function checkFileIsIncluded($chkFile, $ignorePath = true) {
if((bool)$ignorePath === true) {
return in_array($chkFile, preg_replace("/\/.*\//", "",
get_included_files()));
} else {
if(!is_file($chkFile)) {
throw new Exception("File Passed does not exist!");
}
return in_array($chkFile, get_included_files());
}
}
?>