Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Converting URLs to anchor tagsCode Wizard, 12-30-2006 |
Using preg_replace to convert non-anchored URLs into HTML hyperlinks.
<?php
$text = "This is a link to http://www.wjgilmore.com/.";
echo preg_replace("/http://(.*)//", "<a href="${0}">${0}</a>", $text);
// from "Beginning PHP 5 and MySQL: From Novice to Professional", courtesty apress.com
?>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

