I did a quick search for something like this below but did not find it. 

Would you please criticize it. Thanks.

function &MakeUrls(&$data) {
        $words = explode(" ", $data);
        $new_data = "";
        while (list ($key,$row) = each ($words) ) {

                if (preg_match ("/^http:\/\//", $row)) {
                        // should just be the url here
                        $new_data .= "<a href=\"$row\">$row</a> ";

                if (preg_match ("/http/", $row)) {      // catch on the line 
break which I did not explode on
                        $row = preg_replace ("/(http[^\s]+)/","<a 
href=\"\\1\">\\1</a>", $row);

                $new_data .= "$row ";

        return $new_data;               
} # End Get


"Reality is that which, when you stop believing in it, doesn't go
                -- Philip K. Dick

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to