I have this laid out:
1-Mike|
2-Jane|
3-Brad|
4-Kelly|
How do I have the output sort in ASC order based on the name first, then the id? It currently sorts based on how it was originally laid out.
Here's what I have.
function class($students) {
$students = explode("|",$students);
$students_cnt = count($students);
$i=0;
unset($opt);
while($i<$students_cnt) {
$opt_arr = explode("-",$students[$i]);
if((int)$opt_arr[0] && $opt_arr[1])$opt .= "<option value=\"".$opt_arr[0]."\">".$opt_arr[1]."</option>\n";
$i++;
}
return $opt;
}