note 38997 modified in function.set-include-path by didou
| From: | didou@php.net | Date: | Wed, 14 Jan 2004 12:18:18 +0000 |
| Subject: | note 38997 modified in function.set-include-path by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63517@lists.php.net to get a copy of this message | ||
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);
}
?>
--was--
[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);
}
?>
http://www.php.net/manual/en/function.set-include-path.php