note 30638 deleted from function.realpath by aidan
| From: | aidan@php.net | Date: | Sun, 29 Aug 2004 21:51:22 +0000 |
| Subject: | note 30638 deleted from function.realpath by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75614@lists.php.net to get a copy of this message | ||
Note Submitter: jwhite at ytztech dot com
----
Here's a short function to return the "real_path" of a file, but with support for
*nix-based and Win32-based systems:
function get_path($filename) {
if (eregi('WIN',PHP_OS)) {
$filename = str_replace('\\\\','/',$filename);
} // End of IF
$slash = '/';
return str_replace(strrchr($filename,'/'),$slash,$filename);
} // End of FUNCTION get_path();
If you don't want a trailing slash, change '/' to '' on line 7.
--
Justin White, CCNA MCSE
Consultant / YTZ Technical Services, LLC
jwhite@ytztech.com