string bytes2human(string string) -- Make URLs in a text clickable
<?php |
This will output:
url: <a href="http://php.net">http://php.net</a> email: <a href="mailto:noone@nowhere.com>noone@nowhere.com</a> |
Published under the terms of the BSD License
<?php
function make_clickable($text) {
$ret = eregi_replace( "([[:alnum:]]+)://([^[:space:])>]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a>", $text);
$ret = eregi_replace( "(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", "<a href=\"mailto:\\1\">\\1</a>", $ret);
return $ret;
}
?>
Last updated: Sat Jun 14 20:02:45 CEST 2008