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

objective c - Can't build GCM with Protobuf in Xcode -

Winapi c++: DialogBox hangs when breaking a loop -

How to use function view in Drupal -