pcw Posted February 19, 2009 Share Posted February 19, 2009 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 :-( Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/ Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 dude, you already have a thread on this, why did you make a new one? Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/#findComment-766428 Share on other sites More sharing options...
pcw Posted February 19, 2009 Author Share Posted February 19, 2009 Because I didnt think anybody would read and answer it, if it already had a reply. But you have kind of defeated the object by answering to this post :-( Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/#findComment-766431 Share on other sites More sharing options...
allworknoplay Posted February 19, 2009 Share Posted February 19, 2009 Because I didnt think anybody would read and answer it, if it already had a reply. But you have kind of defeated the object by answering to this post :-( lol you could have just bumped your other thread!! Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/#findComment-766433 Share on other sites More sharing options...
sasa Posted February 19, 2009 Share Posted February 19, 2009 foreach (split('/%%/', $templateflat) as $part) Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/#findComment-766438 Share on other sites More sharing options...
pcw Posted February 19, 2009 Author Share Posted February 19, 2009 hi sasa, thanks for your reply, just what I needed. Yr a star :-) Quote Link to comment https://forums.phpfreaks.com/topic/145989-foreach-help-please/#findComment-766443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.