Asday Posted July 18, 2007 Share Posted July 18, 2007 <?php // ... for($x=($piccies=(scandir("upld194")))) // line 22 // ... ?> Produces: Parse error: syntax error, unexpected ')', expecting ';' in C:\xampp\htdocs\new\index.php on line 22 And I can't, for the life of me, work out where to put the stuff. Halp, please. Quote Link to comment https://forums.phpfreaks.com/topic/60559-variables-semicolons-and-brackets/ Share on other sites More sharing options...
ToonMariner Posted July 18, 2007 Share Posted July 18, 2007 while? for expects at least 3 expressions to be passed something like $i=0; $i<$end; $i++ what are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/60559-variables-semicolons-and-brackets/#findComment-301266 Share on other sites More sharing options...
Psycho Posted July 18, 2007 Share Posted July 18, 2007 Well, I would advise against putting all that on one line as it is not easy to read and undersand what is going on. It might be when you are writing it, but for an outsider or yourself going through it at a later date it may be more difficult. The problem, I believe, is that you are using a for loop instead of a foreach loop. A for loop takes three parameters separated by a semicolon. You are dealing with an array, so you want a foreach loop. Try this: foreach(scandir("upld194") as $x) Quote Link to comment https://forums.phpfreaks.com/topic/60559-variables-semicolons-and-brackets/#findComment-301274 Share on other sites More sharing options...
Asday Posted July 18, 2007 Author Share Posted July 18, 2007 Well, I would advise against putting all that on one line as it is not easy to read and undersand what is going on. It might be when you are writing it, but for an outsider or yourself going through it at a later date it may be more difficult. The problem, I believe, is that you are using a for loop instead of a foreach loop. A for loop takes three parameters separated by a semicolon. You are dealing with an array, so you want a foreach loop. Try this: foreach(scandir("upld194") as $x) That was the problem, thanks. It all werks now. Quote Link to comment https://forums.phpfreaks.com/topic/60559-variables-semicolons-and-brackets/#findComment-301280 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.