I have a string called $columns which dynamically gets a value from 1 to 7. I want to create a loop of for however many times
$columns
If $columns is a string you can cast to int and use a simple for loop
string
int
for ($i=1; $i<(int)$columns; $i++) { echo ''; }