hakkikonu hakkikonu - 1 year ago 65
PHP Question

Replace string or explode() function

I have a link in format like


I want to to convert it to


How can I do it?

I tried it with PHP's
function, but when I explode some part of string, then I add it to itself it does not work.

Answer Source
$str = 'http://example.com/a/b.swf';
$str = str_replace('http://', 'http://cache.', $str);