note 30638 added to function.realpath

From: Date: Mon, 24 Mar 2003 17:10:44 +0000
Subject: note 30638 added to function.realpath
Groups: php.notes 
Request: Send a blank email to php-notes+get-45742@lists.php.net to get a copy of this message
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 -- http://www.php.net/manual/en/function.realpath.php http://master.php.net/manage/user-notes.php?action=edit+30638 http://master.php.net/manage/user-notes.php?action=delete+30638 http://master.php.net/manage/user-notes.php?action=reject+30638

« previous php.notes (#45742) next »