Tuesday, 4 December 2012

Sample code

At times you come across a scenario where the string contains an http link and you need to create the hyperlink to the same.

This is can very well achieved using the single line of code.


$text = "This is http://www.phpcoaching.in site";
echo $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $text);




No comments:

Post a Comment