note 87448 added to function.set-include-path

From: Date: Fri, 05 Dec 2008 13:25:09 +0000
Subject: note 87448 added to function.set-include-path
Groups: php.notes 
Request: Send a blank email to php-notes+get-147680@lists.php.net to get a copy of this message
Thanks Ricardo, just what I was looking for, although it could be refined a little: <?php function add_include_path($path) { $paths = explode(PATH_SEPARATOR, get_include_path()) ; // get existing paths once foreach (func_get_args() as $path) { if (!file_exists($path) OR (file_exists($path) && filetype($path) !== 'dir')) { trigger_error("Include path '{$path}' does not exist", E_USER_WARNING); continue; } $paths[] = $path ; // just add them all } $paths = array_flip(array_flip($path)) ; // remove duplicates set_include_path(implode(PATH_SEPARATOR, $paths)); // set all paths just once } ?> ---- Server IP: 87.124.35.190 Probable Submitter: 91.110.16.241 ---- Manual Page -- http://www.php.net/manual/en/function.set-include-path.php Edit -- https://master.php.net/note/edit/87448 Del: integrated -- https://master.php.net/note/delete/87448/integrated Del: useless -- https://master.php.net/note/delete/87448/useless Del: bad code -- https://master.php.net/note/delete/87448/bad+code Del: spam -- https://master.php.net/note/delete/87448/spam Del: non-english -- https://master.php.net/note/delete/87448/non-english Del: in docs -- https://master.php.net/note/delete/87448/in+docs Del: other reasons-- https://master.php.net/note/delete/87448 Reject -- https://master.php.net/note/reject/87448 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#147680) next »