hi guys i am making a comment section on my site... and i want my users to be able to provide url link... which will automatically be appearing as a link... suppose if the users write anything with "http://" it will be acted as a link... now how can i do that?? thanks in advance...
function parse_links($text) { return preg_replace('~(?:ht|f)tps?://[^\s\(\)"\'<>\!]+~i', '<a href="$0">$0</a>', $text); } PHP: ... untested, but should work.
that's an regular expression, they are a lil hard to read but they work really good. You might google and look at some tutorials then you will soon know how to use regular expressions.
I always thought that regular expression is a combination of smiley faces. but only after I learned how to use it I finally understood how amazing it is.