I'm using the following PHP script on an e-commerce site to display retail locations out of a database:
The issue is that I now need to display the locations in four columns displaying from top to bottom in each one in ABC order. But not every state has a location. So the way it's divided up needs to be based on the number of results in the $states array.
$state_ids = array_map('break_down_by_id', Db_DbHelper::queryArray('select distinct state_id as id from foxylocator_locations where country_id = ?', array($country->id)));
$states = Shop_CountryState::create()->where('id in (?)', array($state_ids))->find_all();
<? foreach($states as $state): ?>
<h5><?= $state->name ?></h5>
<? endforeach ?>
How can I take the array and divide it up into four equal (or close to it) <div> columns?
Thank you for your help!