manalnor Posted March 19, 2012 Share Posted March 19, 2012 Hello friends, i'd like to write the following code if it possible but it always gives error <?PHP echo "<img src=\""for($i=0;$i<count($spam_stop);$i++){echo $spam_stop[$i].'+';}"\">"; ?> it gives the following error Parse error: syntax error, unexpected T_FOR, expecting ',' or ';' ~ thanks for help Link to comment https://forums.phpfreaks.com/topic/259299-syntax-error/ Share on other sites More sharing options...
Adam Posted March 19, 2012 Share Posted March 19, 2012 You can't have a control structure within an echo like that. You would need to loop through prior to the echo and build up a string, that you then concatenate into the echo. Link to comment https://forums.phpfreaks.com/topic/259299-syntax-error/#findComment-1329233 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.