function ksort_by_domain(&$array) { $sort = array(); foreach (array_keys($array) as $key) { $sort[delimiter_reverse($key)] = $key; } ksort($sort, SORT_STRING); $result = array(); foreach ($sort as $key) { $result[$key] =& $array[$key]; } $array = $result; }
function summarize_detail_newtral($progress = array()) { if (!isset($progress['hosts']) || !is_array($progress['hosts']) || empty($progress['hosts'])) { return ''; } // Sort by domain $tmp = array(); foreach ($progress['hosts'] as $value) { $tmp[delimiter_reverse($value)] = $value; } ksort($tmp); return count($tmp) . ' (' . implode(', ', $tmp) . ')'; }