note 93304 added to function.strrchr
| From: | EmmanuelCasilang at yahoo dot com | Date: | Wed, 02 Sep 2009 08:40:58 +0000 |
| Subject: | note 93304 added to function.strrchr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160152@lists.php.net to get a copy of this message | ||
This is an efficient way to get only the location or directory of a webpage. It uses both the
stristr() and strrchr() function.
(NOTE: I am going to send the next code for the URL)
//This function displays the location/directory of the
//webpage only.
//Uses a combination of stristr() and strrchr() functions
function emmanuelcasilang() {
//get the location/directory of the webpage including
//the webpage name
$elcPageDir = stristr($_SERVER['SCRIPT_FILENAME'], '/');
//get the webpage name only
$elcPageName = trim(strrchr($_SERVER['SCRIPT_FILENAME'], '/'), '/');
//get the location/directory of the webpage only
$emmanuelcasilang = trim($elcPageDir, $elcPageName);
return $emmanuelcasilang;
}
echo emmanuelcasilang();
----
Server IP: 69.147.83.197
Probable Submitter: 203.167.116.178
----
Manual Page -- http://www.php.net/manual/en/function.strrchr.php
Edit -- https://master.php.net/note/edit/93304
Del: integrated -- https://master.php.net/note/delete/93304/integrated
Del: useless -- https://master.php.net/note/delete/93304/useless
Del: bad code -- https://master.php.net/note/delete/93304/bad+code
Del: spam -- https://master.php.net/note/delete/93304/spam
Del: non-english -- https://master.php.net/note/delete/93304/non-english
Del: in docs -- https://master.php.net/note/delete/93304/in+docs
Del: other reasons-- https://master.php.net/note/delete/93304
Reject -- https://master.php.net/note/reject/93304
Search -- https://master.php.net/manage/user-notes.php