public static function removeEmptyIndexes($array) { $length = count($array); for ($i = $length - 1; $i >= 0; $i--) { if (trim($array[$i]) == '') { unset($array[$i]); } } sort($array); return $array; }