note 105913 deleted from function.echo by danbrown

From: Date: Mon, 26 Sep 2011 14:54:23 +0000
Subject: note 105913 deleted from function.echo by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183445@lists.php.net to get a copy of this message
Note Submitter: apandy3 at gmail dot com ---- Clickable links can be made with echo function. Look at the example below: <?php function makeClickableLinks($text) { $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text); return $text; } // Usage // Email address example $text = "name@show-ip.org"; echo makeClickableLinks($text); echo "<br /><br />"; // URL example $text = "http://www.show-ip.org"; echo makeClickableLinks($text); echo "<br /><br />"; // FTP URL example $text = "ftp://ftp.show-ip.org"; echo makeClickableLinks($text); ?>

« previous php.notes (#183445) next »