note 66723 deleted from function.include by peehaa

From: Date: Fri, 09 Dec 2016 22:48:57 +0000
Subject: note 66723 deleted from function.include by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208390@lists.php.net to get a copy of this message
Note Submitter: medhefgo at googlemail dot com ---- Because there is no quick way to check if a file is in include_path, I've made this function: <?php function is_includeable($filename, $returnpaths = false) { $include_paths = explode(PATH_SEPARATOR, ini_get('include_path')); foreach ($include_paths as $path) { $include = $path.DIRECTORY_SEPARATOR.$filename; if (is_file($include) && is_readable($include)) { if ($returnpaths == true) { $includable_paths[] = $path; } else { return true; } } } return (isset($includeable_paths) && $returnpaths == true) ? $includeable_paths : false; } ?>

« previous php.notes (#208390) next »