This seems simple enough, but I've not found the answer.
Users are posting URLs and email addresses through a textarea in a form which saves the posts in MySQL. I'd like a snippet of code which recognises the URLs, email addresses and inserts them between HTML link tags, as follows:
Example 1
$message = "Visit http://here.com, it's great!"
-> PHP code ->
$message = "Visit <a href="http://here.com>http://here.com</a>, it's great!"
Example 2
$message = "If you find my cat, please email me at found@lostcat.com."
-> PHP code ->
$message = "If you find my cat, please email me at <a href="mailto:found@lostcat.com">found@lostcat.com</a>."