I think that you have something like this: $HTTP_SERVER_VARS['SCRIPT_NAME] == '\foo\bar.php'
$HTTP_SERVER_VARS["SCRIPT_FILENAME"] == 'c:\wwwroot\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( $HTTP_SERVER_VARS['SCRIPT_NAME' . '$', '', $HTTP_SERVER_VARS["SCRIPT_FILENAME"]); 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 below). 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: http://merrowinternet.com/downloads?source=ml -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php