|
Posted by Krustov on 11/10/05 22:40
<comp.lang.php , Krustov , krusty@krustov.co.uk.INVALID>
<MPG.1ddd991e1a81c0c498a68a@no-cancel.newsreader.com>
<Thu, 10 Nov 2005 17:52:02 -0000>
> > > For use in a install.php
> > >
> > > What would be the best way to do it .
> >
> > Probably with getcwd().
> > http://php.net/getcwd
> >
>
> Sounds good to me - thank you .
>
As I only need/want the last folder name and as i'm still a bit of a php
newbie is there any better way of doing it than the following .
(havent tried it on the webspace yet but assume it works just as well)
<?php
$junk=getcwd();
print $junk;
$pass="0"; $long=0;
$tv=strlen($junk); $dvd=$tv-1;
while ($pass=="0")
{
$vhs=substr($junk,$dvd,1);
if ($vhs==chr(47)) {$pass=1;}
if ($vhs==chr(92)) {$pass=1;}
$long=$long+1; $dvd=$dvd-1;
}
$vhs=substr($junk,$dvd+2,$long-1);
print "<br><br>";
print "$vhs";
?>
Navigation:
[Reply to this message]
|