On 10/13/2006, "Nick Jones" <[EMAIL PROTECTED]> wrote:
>Hey list, I've got a PHP script that is supposed to parse through a block of
>text and converts all the web addresses in the block into clickable links.
>This is for a chat page I am creating for my family to use to keep in touch.
>When I try to run the file and post a new message on the page, I get:
>
>Parse error: syntax error, unexpected T_FOREACH in ..../w.php on line 68
>
>And here is the offending block of code on line 68 (line 44 in the attachment):
>
> foreach ($outarr as $val) {
> if(strpos($val,"http://") === 0){
> $val = '<a href="' . $val . '">' . $val . '</a>';
> }elseif(strpos($val,"ftp://") === 0){
> $val = '<a href="' . $val . '">' . $val . '</a>';
> }else{
> $val = $val;
> }
> }
>
Nick - what is the purpose of assigning a value to $val within this
foreach(), when the foreach is initializing a new $val within itself on
each iteration?
I believe you'll have much greater success if you use a different
variable on the left side of those three assignments.
hth,
Mike
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php-list/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/