note 61754 added to function.dirname

From: Date: Sat, 11 Feb 2006 00:02:22 +0000
Subject: note 61754 added to function.dirname
Groups: php.notes 
Request: Send a blank email to php-notes+get-103476@lists.php.net to get a copy of this message
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. ---- Server IP: 64.71.164.2 Probable Submitter: 67.181.154.141 ---- Manual Page -- http://www.php.net/manual/en/function.dirname.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61754 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61754&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61754&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103476) next »