Re: Get previous folder
| From: | Groboski, Joshua | Date: | Tue, 22 Jul 2003 15:42:04 +0000 |
| Subject: | Re: Get previous folder | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156243@lists.php.net to get a copy of this message | ||
You could also explode() on "/" and have all your directories in an
array.
Joshua Groboski
SAVVIS Communications
http://www.savvis.net
"David Nicholson" <me@djnicholson.com> wrote in message
news:<3d43cb0230c4f1ab6b9700689a881ec5@home.djnicholson.com>...
Hello,
This is a reply to an e-mail that you wrote on Thu, 10 Jul 2003 at
13:04, lines prefixed by '>' were originally written by you.
> Anyone know how I can stip off the end of a folder location, so that
> it will be a folder in the next level up? I want to turn something
> like
this:
> /path/to/folder/MyFolder/
> into somthing like this:
> /path/to/folder/
> I just need to strip off the last folder and that is it. Can anyone
> help me out? I appreciate it. Thanks.
> Matt
Try
$folder = "/path/to/folder/MyFolder/";
$upOneLevel = dirname($folder); // $folder now contains
"/path/to/folder/"
For more info look at: http://uk2.php.net/manual/en/function.dirname.php
HTH
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)
----------