Posted By

manavecplan on 03/28/10


Tagged


Versions (?)

Turn Plain Text URLs into Active Links using PHP


 / Published in: PHP
 

URL: http://bavotasan.com/tutorials/turn-plain-text-urls-into-active-links-using-php/

  1. function HyperlinkText($text) {
  2. return ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\">\</a>", $text);
  3. }
  4.  
  5. If people put this function in the bottom of their PHP file, they can now simply call it throughout the code by typing:
  6.  
  7. echo HyperlinkText("Your http://thisismyurl.com here.");

Report this snippet  

You need to login to post a comment.