I've tried this code and it works wonders.
$string = "/tgwedding/users/client1/sites/testgrabid.php"; $thisarray = explode("/", $string); foreach($thisarray as $item) { if(ereg('client', $item)) { $found = $item; $num = ereg_replace('client', '', $found); } } echo $num; /////////////////////////// the above script will echo "1" from the string (plan to substitute that string with $PHP_SELF But I'm wondering if it will work when I setup a domain name with a registrar and have that domain name MASKED and FORWARDED to a URL directory that contains "/tgwedding/users/client1/sites/testgrabid.php". Will this still work or will it not detect the "client1" in the string because the URL is masked/forwarded. I guess the question is with $PHP_SELF too....when you echo $PHP_SELF in a script that is run from a masked domain name will it echo the real directory URL or the masked one. Thanks, Ryan