Warning: session_start(): open(/var/cpanel/php/sessions/ea3/sess_c05d0b477fa363471552ac9e9a9f58d2, O_RDWR) failed: No such file or directory (2) in /home/vizuanet/public_html/layout/vital/vital.php on line 12

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/vizuanet/public_html/layout/vital/vital.php:12) in /home/vizuanet/public_html/layout/vital/vital.php on line 12

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/vizuanet/public_html/layout/vital/vital.php:12) in /home/vizuanet/public_html/layout/vital/vital.php on line 12
Automatically Convert URLs to Links - PHP - Development - Vizua - Awesome Web Templates

Automatically Convert URLs to Links - PHP

Published on Friday, 15th May in Development

You may have been stuck in a situation where you wanted to convert all URLs inside a block of text to clickable links, but to keep already constructed links intact.

Automatically Convert URLs to Links - PHP If you're not too familiar with regex, you might find yourself stuck with getting all URLs converted to clickable links inside a block of text, instead of just passing a single line of string to a function. This small function will do just that - convert all URLs to clickable links.

# make links out of urls
function autolink($string)
{
	$string = preg_replace('$(https?://[a-z0-9_./?=&-]+)(?![^<>]>)$i', ' $1 ', $string." ");
	return $string;
}

Worth Reading

Saturday, 25th Apr in CSS Tutorials

Understanding the Difference Between DIV and SPAN

It can be a bit confusing trying to figure out when to use a span and when to use a division, but this quick tutorial should help to clarify things.

Tuesday, 21st Apr in Development

Google's Mobile Friendly Update

Earlier this year, Google announced that it was making a change to its search algorithms and today they begin rolling out their mobile-friendly update.

From the Archives

Connect

Connect

Fixed-width corporate template featuring large pitch area.