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; } ?> 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; 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? Link to comment https://forums.phpfreaks.com/topic/155063-help-with-for-selection/#findComment-815583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.