I'm assuming that you want to do this so that you can click on links, and not use relative names, etc. on your development machine? If that's true, rather than hard coding your "/usr/local/apache/htdocs/foo/" change it to $_SERVER['DOCUMENT_ROOT'] and make everything relative to that.
eg, you want to link to the file bar.php in the folder 'foo'.
echo "<a href=\"".$_SERVER['DOCUMENT_ROOT']."/foo/bar.php\">bar.php</a>";
If that's NOT what you want it for, what DO you want it for?? (Not flaming, just genuinely curious!)