note 38997 deleted from function.set-include-path by nlopess
| From: | nlopess@php.net | Date: | Thu, 15 Jan 2004 14:50:35 +0000 |
| Subject: | note 38997 deleted from function.set-include-path by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63620@lists.php.net to get a copy of this message | ||
Note Submitter: MagicalTux at FF.ST
----
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);
}
?>