I want to add the last digit of $colnum as you see in the following. Please refer to comments in the codes.

```
for($c=2;$c<$keynum;$c++){
...
...
$studentcomment = '';
for($col=1;$col<5;$col++){
    $colnum="col".$col."_".$c;// this will find col1_2, col2_2, col3_2, col4_2 
    $colnum= $this->input->post($colnum);// this will get value from post. 
    //e.g. col11, col12 col13 col14 or col15
    echo "colnum is ";
    echo $colnum; // this will be col12
    echo "<br />";
    $subgrade="";
    $subgrade = substr($colnum,-1);// get the last digit
    if($subgrade<5 AND !empty ($subgrade)){// 5 has no comment so excluded
        echo "subgrade is ";
        echo $subgrade;// this will be 2,3 or 4
        $total="";
        $total += $subgrade;// add all the subgrade to find the total
        echo "<br />";
        echo "Total collaboration marks is ";
        echo $total;
    }

    if(!empty($colnum)){
        $studentcomment .=$this->lang->line($colnum);//output all the comments 
from language file.
    }

}

```

However the output is the following and not adding numbers.

```
colnum is col15
colnum is col24
subgrade is 4
Total is 4
colnum is col33
subgrade is 3
Total is 3
colnum is col42
subgrade is 2
Total is 2

```

I will appreciate your help.Thanks in advance.