NYCPHP Meetup

NYPHP.org

[nycphp-talk] text to link function

Jeremy Hise jhise at linuxforbusiness.org
Sun Jul 7 11:25:43 EDT 2002


Hey dude:

The following code looks for stuff in the format of:

www.----

and replaces it with 

<a href = 'http://www.----'>www.-----</a>

You can tweak it for your purposes.

Good luck,

Hise

---------------------------------
<?php
$test_text = ereg_replace("www.[^<>[:space:]]+[[:alnum:]/]", "<a href =
http://\\\\0>\\\\0</a>", $test_text);

?>
---------------------------------






On Sun, 2002-07-07 at 04:10, Donald J. Organ IV wrote:
> Does anyone know of any text to link functions out there??
> 
> to clerify what i need is i have a variable $foo and i need to display any
> urls, if anythat are in that variable to be displayed as a link.
> 
> Any help would be appreciated.
> 
> --Donald
> 
> 
> 
> 
> 





More information about the talk mailing list