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 Link to comment https://forums.phpfreaks.com/topic/91671-fix-this-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/91671-fix-this-problem/#findComment-469499 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); ?> Link to comment https://forums.phpfreaks.com/topic/91671-fix-this-problem/#findComment-469528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.