vikal Posted February 18, 2008 Share Posted February 18, 2008 <?php $bag = array(1,2,3,4,5); shuffle ($bag); // shake the bag for ($i=0; $i<5; $i++) { echo array_pop($bag); // pull from the bag } ?> in this code there is problem in for loop with this error....Parse error: parse error, unexpected T_INC, expecting ')'... can any one tell about the brief explanation of this code Quote Link to comment Share on other sites More sharing options...
trq Posted February 18, 2008 Share Posted February 18, 2008 There are no syntax errors in that piece of code. Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 array pop takes the last array element >>>5<<< off the end and results in 1 2 3 4 5 has gon becouse it poped off..... example <?php $bag = array("1","2","3","4","5"); $x=array_pop($bag); // pull from the bag print_R($bag); ?> Quote Link to comment 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.