note 38997 added to function.set-include-path
| From: | MagicalTuxatFF dot ST at rn2 dot php dot net | Date: | Wed, 14 Jan 2004 10:38:14 +0000 |
| Subject: | note 38997 added to function.set-include-path | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63503@lists.php.net to get a copy of this message | ||
[feel free to erase my previous note]
Giovanni wrote a good code, but it will only work on UNIX based functions.
Here's a more advanced function :
<?php
// Requires PHP 4.3
function appendpath($path) {
return set_include_path(get_include_path() . DIRECTORY_SEPARATOR . $path);
}
?>
If you do not have PHP 4.3, use that :
<?php
if (!defined('DIRECTORY_SEPARATOR')) {
if (substr(PHP_OS,0,3)=='WIN') {
define('DIRECTORY_SEPARATOR',';'); // windows uses ;
} else {
define('DIRECTORY_SEPARATOR',':'); // others use :
}
}
function appendpath($path) {
return ini_set('include_path', ini_get('include_path') . DIRECTORY_SEPARATOR .
$path);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.set-include-path.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38997
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38997&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38997&report=yes
Search -- http://master.php.net/manage/user-notes.php