php - Linking URL in middle of string -


wondering how detect url in string , return link. example

$text = 'go www.example.com example.com example.net http://example.com'; echo $text;

would return

go www.example.com example.com etc.

you use regex, or explode $text string on spaces , check substring each exploded word if begin http://, https:// or end in .com, .net, .org , wrap string in link


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -