Convert PHP array to Bootstrap grid

function bootstrapGrids($gridCols, $columns = 3) {
    if (is_array($gridCols) && count($gridCols) && is_numeric($columns)) {
        $array = array_chunk($gridCols, ceil(count($gridCols) / $columns));
        $content .= '<div class="row">';
        foreach ($array as $col => $colArray) {
            $content .= '<div class="col-md-' . ceil((12 / $columns)) . '">';
            $content .= implode('', $colArray);
            $content .= '</div>';
        }
        $content .= '</div>';
        return $content;
    }
}