note 49582 added to function.basename
| From: | spartacus at openphp dot nl | Date: | Wed, 02 Feb 2005 11:13:02 +0000 |
| Subject: | note 49582 added to function.basename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84359@lists.php.net to get a copy of this message | ||
I created a simple function to get the name of the file without extension. Here it is:
<?php
//© 2005 SpArTaCuS
function getbasename($url) {
$url = basename($url, ".gif");
$url2 = explode(".", $url);
if (count($url2) > 2) {
$c = count($url2);
$c--;
foreach ($url2 as $n => $v) {
if ($n != $c) {
$url3 .= $v;
}
}
return $url3;
}
else {
return $url2[0];
}
}
?>
I hope you like it ;)
Greetz,
Spartacus
----
Manual Page -- http://www.php.net/manual/en/function.basename.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49582
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49582&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49582&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49582&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49582&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49582&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49582&report=yes
Search -- http://master.php.net/manage/user-notes.php