note 43387 added to function.count
| From: | webmasteratmelchiordotus at rn2 dot php dot net | Date: | Sat, 19 Jun 2004 13:12:01 +0000 |
| Subject: | note 43387 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71339@lists.php.net to get a copy of this message | ||
Not sure if this is the best way to do something like this or not but this will return however many
'../' things are needed to get to the base dir. I find it useful for links or something
that you have a in sub directory...
$base_url = dirname($HTTP_SERVER_VARS['PHP_SELF']);
$array = explode('/', $base_url);
$subs = count($array) - 2;
$i = 0;
$sub = '';
while($i < $subs) {
$sub .= '../';
$i++;
}
If there's an easier and less of a processful way to do this, let me know. :-)
----
Manual Page -- http://www.php.net/manual/en/function.count.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43387
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43387&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43387&report=yes
Search -- http://master.php.net/manage/user-notes.php