getting base directory
am 02.04.2008 17:59:45 von Aaron Gray
I want a function that gives me the base directory of a script.
So when given the script file '/var/www/test.org/html/test/index.php' from
$_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.
I am wondering the neatest way to do this ?
I cannot find a reverse string search function.
Many thanks in advance,
Aaron
Re: getting base directory
am 02.04.2008 18:01:13 von Steve Foley
"Aaron Gray" wrote in message
news:65horiF2g0v0aU1@mid.individual.net...
> I want a function that gives me the base directory of a script.
>
> So when given the script file '/var/www/test.org/html/test/index.php' from
> $_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.
>
> I am wondering the neatest way to do this ?
>
> I cannot find a reverse string search function.
>
> Many thanks in advance,
>
> Aaron
>
>
basename
Re: getting base directory
am 02.04.2008 18:03:01 von Aaron Gray
"Steve Foley" wrote in message
news:d5OIj.14899$oE1.7400@trndny09...
> "Aaron Gray" wrote in message
> news:65horiF2g0v0aU1@mid.individual.net...
>> I want a function that gives me the base directory of a script.
>>
>> So when given the script file '/var/www/test.org/html/test/index.php'
>> from
>> $_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.
>>
>> I am wondering the neatest way to do this ?
>>
>> I cannot find a reverse string search function.
>>
>> Many thanks in advance,
>>
>> Aaron
>>
>>
>
> basename
That was quick :)
Thanks,
Aaron
Re: getting base directory
am 02.04.2008 18:04:44 von Aaron Gray
"Steve Foley" wrote in message
news:d5OIj.14899$oE1.7400@trndny09...
> "Aaron Gray" wrote in message
> news:65horiF2g0v0aU1@mid.individual.net...
>> I want a function that gives me the base directory of a script.
>>
>> So when given the script file '/var/www/test.org/html/test/index.php'
>> from
>> $_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.
>>
>> I am wondering the neatest way to do this ?
>>
>> I cannot find a reverse string search function.
>>
>> Many thanks in advance,
>>
>> Aaron
>>
>>
>
> basename
You mean dirname not basename !:)
Aaron
Re: getting base directory
am 02.04.2008 18:24:26 von Hans-Peter Sauer
<65hpe8F2fl881U1@mid.individual.net>
> > basename
>
> You mean dirname not basename !:)
>
$batman=pathinfo($doc,PATHINFO_DIRNAME);
Havent actually tried it myself - its just a snippet of code i have .
--
www.krustov.co.uk
Re: getting base directory
am 02.04.2008 18:35:18 von Aaron Gray
"Krustov" wrote in message
news:MPG.225dc386ad8c913b98b370@news.newsreader.com...
>
>
>
> <65hpe8F2fl881U1@mid.individual.net>
>
>> > basename
>>
>> You mean dirname not basename !:)
>>
>
> $batman=pathinfo($doc,PATHINFO_DIRNAME);
>
> Havent actually tried it myself - its just a snippet of code i have .
It works I have used it in my utils.
Aaron
Re: getting base directory
am 02.04.2008 19:10:05 von Steve Foley
"Aaron Gray" wrote in message
news:65hpe8F2fl881U1@mid.individual.net...
>
> You mean dirname not basename !:)
>
> Aaron
Yup.