note 83186 added to function.include

From: Date: Wed, 14 May 2008 18:14:32 +0000
Subject: note 83186 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-139377@lists.php.net to get a copy of this message
Two functions to help: <?php function add_include_path ($path) { foreach (func_get_args() AS $path) { if (!file_exists($path) OR (file_exists($path) && filetype($path) !== 'dir')) { trigger_error("Include path '{$path}' not exists", E_USER_WARNING); continue; } $paths = explode(PATH_SEPARATOR, get_include_path()); if (array_search($path, $paths) === false) array_push($paths, $path); set_include_path(implode(PATH_SEPARATOR, $paths)); } } function remove_include_path ($path) { foreach (func_get_args() AS $path) { $paths = explode(PATH_SEPARATOR, get_include_path()); if (($k = array_search($path, $paths)) !== false) unset($paths[$k]); else continue; if (!count($paths)) { trigger_error("Include path '{$path}' can not be removed because it is the only", E_USER_NOTICE); continue; } set_include_path(implode(PATH_SEPARATOR, $paths)); } } ?> ---- Server IP: 200.185.126.110 Probable Submitter: 200.162.59.125 ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/83186 Del: integrated -- https://master.php.net/note/delete/83186/integrated Del: useless -- https://master.php.net/note/delete/83186/useless Del: bad code -- https://master.php.net/note/delete/83186/bad+code Del: spam -- https://master.php.net/note/delete/83186/spam Del: non-english -- https://master.php.net/note/delete/83186/non-english Del: in docs -- https://master.php.net/note/delete/83186/in+docs Del: other reasons-- https://master.php.net/note/delete/83186 Reject -- https://master.php.net/note/reject/83186 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139377) next »