note 66723 added to function.include

From: Date: Sat, 27 May 2006 11:50:02 +0000
Subject: note 66723 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-112354@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 217.160.72.57 Probable Submitter: 172.158.213.213 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/note/edit/66723 Del: integrated -- http://master.php.net/note/delete/66723/integrated Del: useless -- http://master.php.net/note/delete/66723/useless Del: bad code -- http://master.php.net/note/delete/66723/bad+code Del: spam -- http://master.php.net/note/delete/66723/spam Del: non-english -- http://master.php.net/note/delete/66723/non-english Del: in docs -- http://master.php.net/note/delete/66723/in+docs Del: other reasons-- http://master.php.net/note/delete/66723 Reject -- http://master.php.net/note/reject/66723 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112354) next »