Re: Get previous folder
| From: | David Nicholson | Date: | Thu, 10 Jul 2003 12:33:44 +0000 |
| Subject: | Re: Get previous folder | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154720@lists.php.net to get a copy of this message | ||
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)