Tutoriel N° 93
Voici le script pour rendre cliquable les urls d'une chaine:
<?
// rendre url cliquable
function replace_url_in_text ($text){
$in = array('`((?:https?|ftp)://\S+[[:alnum:]]/?)`si');
$out = array('<a href="$1" target=_blank>$1</a>');
return preg_replace($in, $out, $text);
}
$chaine="http://www.google.com";
echo replace_url_in_text($chaine);
?>
