note 93304 deleted from function.strrchr by thiago

From: Date: Wed, 02 Sep 2009 13:41:51 +0000
Subject: note 93304 deleted from function.strrchr by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160155@lists.php.net to get a copy of this message
Note Submitter: EmmanuelCasilang at yahoo dot com ---- 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();

« previous php.notes (#160155) next »