kaisellgren
09-22-2006, 12:58 PM
Hi,
I would like to convert "http://www.sdgsg.com/dfgdfg/sdfd" to "dfgdfg/sdfd". I have done this so far:
$path = "http://www.localhost.com/dffg/ks";
$path = str_ireplace("http://","",$path);
$path = preg_replace("/.*\//","",$path);
But the only problem is that it returns me "ks", but it should return "dffg/ks"... how do I make the preg_replace command to stop after first match?
I would like to convert "http://www.sdgsg.com/dfgdfg/sdfd" to "dfgdfg/sdfd". I have done this so far:
$path = "http://www.localhost.com/dffg/ks";
$path = str_ireplace("http://","",$path);
$path = preg_replace("/.*\//","",$path);
But the only problem is that it returns me "ks", but it should return "dffg/ks"... how do I make the preg_replace command to stop after first match?