Filesystem path creation function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does such a thing exist in php? My searches have lead nowhere.

What I am looking for is a function which you would pass two parts of a
path to (which might be a directory and a filename, say) and it would
return a string containing the parameters separate by the correct number
of path separators according to the current OS.

For example:

<?php 
$d = 'foo';
$f = 'bar';
$path = createPathString($d, $f);
?>

Would result in 'foo\bar' (Windows), 'foo/bar' (*n*x).

And
<?php 
$d = 'foo/'; // note the trailing slash
$f = 'bar';
$path = createPathString($d, $f);
?>

on *n*x would also result in 'foo/bar' (i.e. the path would only contain
one "/").


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux