无法在php中按列顺序排序日期

I was trying to automate the roll call system in my college and came across this problem,

I'm trying to print the dates of the register and instead of getting normal ordering, i'm getting this sort of output.

This is the output i'm getting in the browser

Here is the code i used in php,

for ( $i = 0 ; $i < count ( $attendance ) ; $i++ )<br>
     $data.="<th rowspan='2'>".$attendance[$i]['date']."</th>";

How are you sorting the dates and how are they stored?

Looks like it's ordering by the first digit, not seeing the date as a whole.