I have those columns in my database table :
value_day_1 | value_day_2| value_day_3 |……|value_day_36
I’m trying to display each value in a view using a for loop
@for ($n=1;$n<37;n++)
{{ $day->value_day_? }}
@endfor
How can i replace the ? by $n ?
3
Answers
One solution would be
I prefer to use range instead of the
for
syntax but it is not neccessary for your problemJust assign to a new variable before
You can do this easily inline: