1 2 3 4 5
if(preg_match('|href="(.*?)">|is', $f, $matches)) { $url = $matches[1]; $url = base64_encode($url); $f = preg_replace('#href="(.*?)">#is', 'href="'.$url.'">', $f); }