title: php html create link from text
body: <p>I found a routine to create a html link when a link is found in a text</p>
  
  <pre><code> &lt;?php
   function makelink($text) 
   {
   return preg_replace('/(http\:\/\/[a-zA-Z0-9_\-\.]*?) /i', '&lt;a href="$1"&gt;$1&lt;/a&gt; ', $text." "); 
   } 
  
   // works
   echo makelink ("hello how http://www.guruk.com ");
  
   // dont work
   echo makelink ("hello how http://www.guruk.com/test.php ");
  </code></pre>
  
  <p>?></p>
  
  <p>as you see in the example, it works find with a domain only, not when there is a page or subdirectory is within that link.</p>
  
  <p>Can you provide a solution for that function to work also with pages and subdirs?</p>
  
  <p>thx
  chris</p>