Can a foreach loop be set as a variable? My script is populating the body of an email and I'd like to capture all the output from the loop into one variable so that I can later reference it in the HTML body.
Each time I attempt to set as a variable I get an error. ie.
No, a function can't be assigned to a variable in PHP. Want you want can be done in a number of ways, for example adding stuff to a variable on each iteration:
You haven't said what the actual problem you are having is though so I don't know if that fixes your issue. If not please provide some detail on what is going wrong.
Bookmarks