tombob Posted April 21, 2009 Share Posted April 21, 2009 Hi I don't know where there error is in this simple piece of code. I get the "unexpected T_VARIABLE on line 114" (in bold below). I don't know what I'm doing wrong. <?php $cookie0=array(top,1,333330); for($i = 1; $i <= 5; $i++) { $cookie0.="^".$cookie$i; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/155063-help-with-for-selection/ Share on other sites More sharing options...
Axeia Posted April 21, 2009 Share Posted April 21, 2009 $cookie0=array(top,1,333330); should probably be $cookie0=array($top,1,333330); if top is a variable. or $cookie0=array('top',1,333330); if top is a string. Furthermore.. $cookie0.="^".$cookie$i; should probably be $cookie0.="^".$cookie.$i; Quote Link to comment https://forums.phpfreaks.com/topic/155063-help-with-for-selection/#findComment-815574 Share on other sites More sharing options...
Philip Posted April 21, 2009 Share Posted April 21, 2009 What are you trying to accomplish with this? This code doesn't make much sense to me. You're trying to concat a string onto an array. I'm guessing you want to do like $cookie0[] = '^'.$cookie0[$i] instead? Quote Link to comment https://forums.phpfreaks.com/topic/155063-help-with-for-selection/#findComment-815583 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.