Copy code The code is as follows:
function showtext($text){
$search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|');
$replace = array('$1', '$1', '$1 ');
$text = preg_replace($search, $replace, $text);
return $text;
}
The above introduces the function of hyperlink font color in PHP to convert a URL into a hyperlink, including the content of hyperlink font color. I hope it will be helpful to friends who are interested in PHP tutorials.