数组显示在表中

I Just need only the values of the arracy search to be displayed in the table column (Position), how do I eliminate the empty columns. I need the keys to be displayed only in the position column of the table

All values should be displayed in 'Position' column

<?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 }?>