[thelist] Getting path minus document root using PHP

Stephen Rider evolt_org at striderweb.com
Fri Dec 14 10:06:18 CST 2007

A few good answers here.  Thanks to all who replied!  :)

I'll probably go with a minor variation on Kasimir's:

> $newstring = preg_replace( '%^/sites/mysite\.com/public_html%', '',  
> $string);

I was kludging it out with a nested if() clause.  This is much  
cleaner and just what I was looking for.  I have a mental block  
regarding '^' and '$' in regexes....

Again, thanks!


More information about the thelist mailing list