function assoc_title($arr, $key)
{
$tmp_arr = array();
foreach ($arr as $k => $v) {
if (in_array($v[$key], $tmp_arr)) {
unset($arr[$k]);
} else {
$tmp_arr[] = $v[$key];
}
}
return $arr;
}//assoc_title end
$key_title = 'stu_name';
$quchong = assoc_title($teachers, $key_title);
echo "<table border=\"1\" bordercolor=\"#CCCCCC\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse\" width=\"20%\">";
echo "<tr><td>id</td><td>学生名</td><td>电话</td></tr>";
$i = 1;
foreach ($quchong as $key => $vale) {
if ($vale['stu_name'] == "游开琳" or $vale['stu_name'] == "韩建通") {
continue;
}
echo "<tr><td>{$i}</td><td>{$vale['stu_name']}</td><td>{$vale['tel']}</td></tr>";
$i++;
}
echo "</table>";
Salin selepas log masuk