Creating Links in data output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi :)  I am new to PHP and new to this mailing list, so I hope I am not asking something that you tire of answering :)

I am creating my first news posting application and I need a function to convert any URLS added to the news message into links.  I found this snippet:

function insert_links($newstext) {
$ret = eregi_replace( "([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $newstext);

$ret = eregi_replace( "(([a-z0-9_]|\-|\.)+@([^[:space:]]*)([[:alnum:]-]))", "\\1", $ret);

return($ret);
}

I have added this snippet to my file, but it does not work -  The string $newstext still does not include links.  I have tried to echo $ret, which returns nothing, and echo $newstext, which returns my text message, but without links.

Does anyone have any other snippets that might work for this?  Please be very 'layman' in your response - I have only been working with PHP for a couple of weeks and this is my first language to learn (other than HTML).

Thanks in advance!!

Summer

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux