I think that you have something like this:

$HTTP_SERVER_VARS['SCRIPT_NAME] == '\foo\bar.php'


and you want to use this to derive the root 'c:\wwwroot'.
You can use one of the standard string edit functions. Something like this:

    $baseName = ereg_replace(

The first argument is regular expression.  This one matches the script name
as long as it appears at the end of the string.  The second argument is the
replacement string (nothing), the third is the string to search.

I cover regular expression pattern matching in my introduction to PHP (see

However, the root directory is an Apache variable and these are passed to
PHP in another array.  I can't remember which right now!

Simon Ritchie

Download my introduction to PHP for $25:

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to