我只需要在表格列(位置)中显示arracy搜索的值,如何消除空列。我需要键才能显示在表格的位置列中
<?php
$subject_mark = $this->crud_model->get_subject_mark($row2['exam_id'], $class_id, $row3['subject_id'], $row1['student_id']);
$subj_pos = $this->crud_model->get_subject_position($row2['exam_id'], $class_id, $row3['subject_id']);
foreach($subj_pos as $key => $row){
$subject_pos = $row['mark_obtained'];
$array = array($key+=1 => $subject_pos);
$result = array_search($subject_mark['mark_obtained'], $array);
?>
<td style="text-align: center;"><?php echo $result; ?></td>
<?php }?>