NYCPHP Meetup

NYPHP.org

[nycphp-talk] Finding and encoding http:// and www in strings

Tim Lieberman tim_lists at o2group.com
Wed Nov 29 19:15:59 EST 2006


Look at preg_replace()

Sorry I don't have any code handy. 

-Tim

Ben Sgro (sk) wrote:

> Hello all,
>
> I have a string
> $str = "This is the link to my website http://www.google.com";
>
> I want to 'encode' the link to be a clickable link, <a
> href=http://www.google.com>www.google.com</a>.
> The text would now be;
> "This is the link to my website <a
> href=http://www.google.com>www.google.com</a>";
>
> What is the best way to do this? Samples code or a lib/class would be
> helpful as well.
>
> Thanks,
>
> - Ben
>
> note: I also want it to work on both www.google.com &
> http://www.google.com
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>




More information about the talk mailing list