Replace hyperlink to text in the string using php

by Jayanthi 2014-01-11 12:10:47

Replace hyperlink to text


function replace_links($text)
{
$search = '/< a s[^>]*href=['"]([^'"]+)['"][^>]*>([^<]+)< /a >/i';
$replace = '2 ';
return(preg_replace($search, $replace, $text));
}
628
like
0
dislike
0
mail
flag

You must LOGIN to add comments