note 96421 added to function.basename
| From: | noemail at nosite dot com | Date: | Fri, 26 Feb 2010 09:00:27 +0000 |
| Subject: | note 96421 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166391@lists.php.net to get a copy of this message | ||
you could use this function when you need basename to work with cyrillic filenames
function pcgbasename($param, $suffix=null) {
if ( $suffix ) {
$tmpstr = ltrim(substr($param, strrpos($param, DIRECTORY_SEPARATOR) ), DIRECTORY_SEPARATOR);
if ( (strpos($param, $suffix)+strlen($suffix) ) == strlen($param) ) {
return str_ireplace( $suffix, '', $tmpstr);
} else {
return ltrim(substr($param, strrpos($param, DIRECTORY_SEPARATOR) ), DIRECTORY_SEPARATOR);
}
} else {
return ltrim(substr($param, strrpos($param, DIRECTORY_SEPARATOR) ), DIRECTORY_SEPARATOR);
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 94.26.30.29
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- https://master.php.net/note/edit/96421
Del: integrated -- https://master.php.net/note/delete/96421/integrated
Del: useless -- https://master.php.net/note/delete/96421/useless
Del: bad code -- https://master.php.net/note/delete/96421/bad+code
Del: spam -- https://master.php.net/note/delete/96421/spam
Del: non-english -- https://master.php.net/note/delete/96421/non-english
Del: in docs -- https://master.php.net/note/delete/96421/in+docs
Del: other reasons-- https://master.php.net/note/delete/96421
Reject -- https://master.php.net/note/reject/96421
Search -- https://master.php.net/manage/user-notes.php