March 30, 2017

Convert MySQL column names to PHP array

function getTableColumnNames($table) { if ($table) { $query = “SHOW COLUMNS FROM ” . $table; $res = $GLOBALS[‘TYPO3_DB’]->sql_query($query); $fields = array(); while ($row = $GLOBALS[‘TYPO3_DB’]->sql_fetch_assoc($res)) {

Read More »

Move array to bottom or to top

function moveArrayKeyToTop(&$array, $key) { $temp = array($key => $array[$key]); unset($array[$key]); $array = $temp + $array; } function moveArrayKeyToBottom(&$array, $key) { $value = $array[$key]; unset($array[$key]); $array[$key]

Read More »

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

Read More »

Most Popular