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
Post a Comment