Randum Ian schrieb: > Hi all, > > Please can someone direct me to the correct function that changes > http://www.foo.com to <a href="http://www.foo.com">http://www.foo.com</a> > for any occurence in a string. > > Cheers, Ian. >
do you wish convert a string in a link ??? try: <?php echo "<a href="$string1">$string1</a>"; ?> or a link in a string ? <?php preg_match('/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\//i', $link, $string) ?> with $string[1]; // protocol type (http,https,ftp) $string[2]; // hostname (domain) $string[3]; // port if available like 80 for http ... please be more precise in your question ! -- @ Goetz Lohmann, Germany | Web-Developer & Sys-Admin \/ ------------------------------------------------------ () He's the fellow that people wonder what he does and || why the company needs him, until he goes on vacation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php