you don't want to assign a foreach loop to a variable (which would be done by having a function containing only the foreach loop that returns the value) you want to append values to a variable during a foreach loop.

seandisanti wrote:you don't want to assign a foreach loop to a variable (which would be done by having a function containing only the foreach loop that returns the value) you want to append values to a variable during a foreach loop.

if it's only outputting the last, that tells me that you missed the '.' before the '='. So on each iteration it is overwriting the existing value instead of appending the new value. take another look at line 4 of my example

seandisanti wrote:if it's only outputting the last, that tells me that you missed the '.' before the '='. So on each iteration it is overwriting the existing value instead of appending the new value. take another look at line 4 of my example

Actually thats exactly what it is doing, it is appending the new value to the value that already exists rather than overwriting it. I'd rather just overwrite it. Maybe I did something wrong?