Re: whats wrong with this function
| From: | Adrian Murphy | Date: | Wed, 03 Jul 2002 13:16:22 +0000 |
| Subject: | Re: whats wrong with this function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105172@lists.php.net to get a copy of this message | ||
relax friend.i was just asking....
----- Original Message -----
From: "1LT John W. Holmes" <holmes072000@charter.net>
To: "Adrian Murphy" <adrian.murphy@2020tourism.com>;
<php-general@lists.php.net>
Sent: Wednesday, July 03, 2002 2:08 PM
Subject: Re: [PHP] whats wrong with this function
> Yes, your problem is it doesn't work.
>
> HTH,
> ---John Holmes...
>
> PS: Think that's a worthless answer? Well...same for your question...
>
> ----- Original Message -----
> From: "Adrian Murphy" <adrian.murphy@2020tourism.com>
> To: <php-general@lists.php.net>
> Sent: Wednesday, July 03, 2002 8:47 AM
> Subject: [PHP] whats wrong with this function
>
>
>
> whats wrong with this.
> it's getting stuck somewhere
>
>
>
> function urls_clickable($string) {
> for($n=0; $n < strlen($string); $n++)
> {
> if(strtolower($string[$n]) == 'h') {
> if(!strcmp("http://", strtolower($string[$n]) .
> strtolower($string[$n+1])
.
> strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] .
> $string[$n+5] . $string[$n+6])) {
> $startpos = $n;
> while($n < strlen($string) &&
> eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]",
> $string[$n])) $n++;
> if(!eregi("[a-z0-9]", $string[$n-1])) $n--;
> $link = substr($string, $startpos, ($n-$startpos));
> $link = $link;
> $string_tmp = $string;
> $string = substr($string_tmp, 0, $startpos);
> $string .= "<a href=\"$link\"
> target=\"_blank\">$link</a>";
> $string .= substr($string_tmp, $n, strlen($string_tmp));
> $n = $n + 15;
> }
> }
> }
> return $string;
> }
>
> $text = "http://www.somewhere.org
> <br><br>";
> echo urls_clickable($text);
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>