Forum Moderators: coopster

Message Too Old, No Replies

how to convert this?

         

PHPycho

11:58 am on Apr 9, 2007 (gmt 0)

10+ Year Member



Hello forums!
suppose i had following string
[PHP]$string = "hello friends . My site is http://example.com";[/PHP]
I want to know:
1> how to convert the string: [$example.com...] is converted into a link .
ie when $string is displayed ie [PHP]echo $string;[/PHP], a link should appear instead of plain text. ie <a href="http://example.com.com">http://$example.com</a>
Note: if the $example.com was static i could solve using str_replace, since its dynamic as it comes from the db. i didnt get the idea..
i think we should search http:// or www. in a word of a string and replace that word...
Please help me..
Thanks in advance to all of you!

[edited by: dreamcatcher at 12:03 pm (utc) on April 9, 2007]
[edit reason] Use example.com, thanks. [/edit]

ahmedtheking

4:27 pm on Apr 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do a bit of reading of: [uk.php.net...]