note 63344 added to function.dirname

From: Date: Mon, 20 Mar 2006 18:49:31 +0000
Subject: note 63344 added to function.dirname
Groups: php.notes 
Request: Send a blank email to php-notes+get-106111@lists.php.net to get a copy of this message
I wanted to get just the current folder that the document is in, but not the rest of the url, so here is a simple replacement array. Might be a little more code than neccessary.. <? $DocName = "" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; $DirNow = dirname($DocName); $drop = array("www.", "yourwebsite", ".com/"); # here you drop the url, ex: www.yourwebsite.com/ $pickup = array("", "", ""); $folder = str_replace($drop, $pickup, $DirNow); echo "Your Current Folder is:<br>"; echo "$folder"; ?> ---- Server IP: 216.194.113.175 Probable Submitter: 69.144.6.194 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.dirname.php Edit -- http://master.php.net/note/edit/63344 Del: integrated -- http://master.php.net/note/delete/63344/integrated Del: useless -- http://master.php.net/note/delete/63344/useless Del: bad code -- http://master.php.net/note/delete/63344/bad+code Del: spam -- http://master.php.net/note/delete/63344/spam Del: non-english -- http://master.php.net/note/delete/63344/non-english Del: in docs -- http://master.php.net/note/delete/63344/in+docs Del: other reasons-- http://master.php.net/note/delete/63344 Reject -- http://master.php.net/note/reject/63344 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#106111) next »