You are here: Re: Find the name of the current folder « PHP Programming Language « IT news, forums, messages
Re: Find the name of the current folder

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация