note 61754 deleted from function.dirname by betz

From: Date: Sat, 11 Feb 2006 00:15:46 +0000
Subject: note 61754 deleted from function.dirname by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-103480@lists.php.net to get a copy of this message
Note Submitter: bobbfwed at comcast dot net ---- I have programmed a really nice program that remotely lets you manage files as if you have direct access to them (http://sourceforge.net/projects/filemanage/). I have a bunch of really handy functions to do just about anything to files or directories. This takes a path and returns just the name of the file with forced forward slashes (for consistancy). It also stores a global variable with the remainder for other uses. Here is the function I made: <?PHP // takes $name and returns just the name of the file, no directories // also outputs $pre_ex as global for other uses // str 'file name of $name' get_name( str 'path of a file' ) *str 'path to file' $pre_ex function get_name($name){ $GLOBALS['pre_ex'] = str_replace('//', '/', str_replace('\\', '/', dirname($name) . '/')); return basename($name); } // end of get_name() ?> This function is in 0.9.7 (the current release of File Manage). Hope this helps some people.

« previous php.notes (#103480) next »