/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function replace_plain_text_link($plain_text) { '/(?<!S)((http(s?):\/\/)|(www.))+([\w.1-9\&=#?\-~%;\/]+)/', '<a href="http$3://$4$5">http$3://$4$5</a>', $plain_text); return ($url_html); } echo replace_plain_text_link("hi this is dummy text before http://www.smjdesign.com hi this is dummy text after")
Comments
