Jump to content

Recommended Posts

Hi, I need some help with this code. The following is just an example of what I have so far, as the script is in excess of 1000 lines.

 

foreach ($part(split('/%%/', $templateflat))  {

 

    if ($part == "search results"){

print "Search Form";

}

}

 

With this code I get the error:

 

Parse error:  parse error, unexpected '{' in sb.php on line 233

 

if i remove '{' I get the error:

 

Parse error:  parse error, unexpected T_IF in sb.php on line 235

 

Can anybody tell me what I have done wrong? 

 

 

Try:

foreach ($part(split('/%%/', $templateflat)))  {

    if ($part == "search results"){

print "Search Form";

}

}

 

You were missing a )

 

Hi, thanks for your reply. I gave this a go and now get the error:

 

Parse error:  parse error, unexpected ')' in sb.php on line 233

 

I really cant figure out what is wrong :-(

Link to comment
https://forums.phpfreaks.com/topic/145989-foreach-help-please/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.