Find url from string with php
<p>following code is used to find url from a string with php. Here is the code:</p>

<pre><code>$string = "Hello http://www.bytes.com world www.yahoo.com";
preg_match('/(http:\/\/[^\s]+)/', $string, $text);
$hypertext = "&lt;a href=\"". $text[0] . "\"&gt;" . $text[0] . "&lt;/a&gt;";
$newString = preg_replace('/(http:\/\/[^\s]+)/', $hypertext, $string);
echo $newString;
</code></pre>

<p>Well, it's show a link but if i provide few link it's doesn't work and also if i write without http:// then it's doesn't show link.  I want whatever link is provided it's should be active, Like stackoverflow.com. </p>

<p>Any help please.. </p>
