Re: String help needed

From: Date: Thu, 24 Aug 2000 03:39:01 +0000
Subject: Re: String help needed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13292@lists.php.net to get a copy of this message
CDitty wrote: > Does anyone have a routine already built that will give you the name of the > current directory? Only the current directory is needed. I don't need the > directory before it or the file that is being called. IE.....If the path > is /refer/yahoo/ , I only need the yahoo. > > I thought about using the various string commands, but I must be too tired > to figure it out. > > This is what I have. > $myPath = $PHP_SELF; > echo $myPath . " - Path<br>"; > echo strlen($myPath) . " - String Length<br>"; > $first = strpos($myPath, ".htm"); > $last = substr($myPath, 7, 1); > echo $first . " - String Pos<br>"; > echo $last . " - Start of Directory name<br>"; > echo strpos($myPath, "index.htm"); > > I have looked over the manual, but like I said, I must be too tired to > figure it out. Anyone? > > TIA > > CDitty > Yes I know the feeling well.. try: dirname() function under file functions? Regards, Joseph

« previous php.general (#13292) next »