note 43388 added to function.count

From: Date: Sat, 19 Jun 2004 13:12:12 +0000
Subject: note 43388 added to function.count
Groups: php.notes 
Request: Send a blank email to php-notes+get-71340@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+43388 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43388&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43388&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71340) next »