unemployment Posted May 4, 2011 Share Posted May 4, 2011 I have a syntax error. I'm not sure what I'm missing. Parse error: syntax error, unexpected ';', expecting ')' $information = array( $i = 0; while ($i = count($actions)) { array($actions[$i], $action_details[$i]) $i++; } ); Quote Link to comment https://forums.phpfreaks.com/topic/235526-while-loop-syntax-error/ Share on other sites More sharing options...
fugix Posted May 4, 2011 Share Posted May 4, 2011 you forgot to end your array line, try this $information = array( $i = 0; while ($i = count($actions)) { array($actions[$i], $action_details[$i]); $i++; } ); Quote Link to comment https://forums.phpfreaks.com/topic/235526-while-loop-syntax-error/#findComment-1210473 Share on other sites More sharing options...
unemployment Posted May 4, 2011 Author Share Posted May 4, 2011 you forgot to end your array line, try this $information = array( $i = 0; while ($i = count($actions)) { array($actions[$i], $action_details[$i]); $i++; } ); That helps a little bit, but I am still getting the same parse error. Parse error: syntax error, unexpected ';', expecting ') . I imagine that it is because I have ; inside of the array. Can I put a while loop in an array? $information = array( $i = 0; while ($i = count($actions)) { array($actions[$i], $action_details[$i]); $i++; } ); Quote Link to comment https://forums.phpfreaks.com/topic/235526-while-loop-syntax-error/#findComment-1210478 Share on other sites More sharing options...
fugix Posted May 4, 2011 Share Posted May 4, 2011 you shouldnt have to, you should be able to create an array within your while loop Quote Link to comment https://forums.phpfreaks.com/topic/235526-while-loop-syntax-error/#findComment-1210482 Share on other sites More sharing options...
unemployment Posted May 4, 2011 Author Share Posted May 4, 2011 you shouldnt have to, you should be able to create an array within your while loop I am creating arrays in the loop but I am also wrapping all the array in an array so that it is a multidimensional array. Quote Link to comment https://forums.phpfreaks.com/topic/235526-while-loop-syntax-error/#findComment-1210484 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.