Hello everyone,
i want to ask you guys help with a little problem im having sorting an array, it seems simple but i just cant get it to work the way i want.
the problem is the following, i have this table:
http://img255.images...43/tabelafp.png
i want to sort it using the first 2 columns, first by date (LOTE WISE) then by the 'sequential' number (LOTE EXTERNO). It has to be one after the other because the sequential number might not be included sequentially, so its possible to have a newer (higher) LOTE EXTERNO with an older LOTE WISE, also, there is a kind of LOTE EXTERNO which is alphanumeric.
the table is inside a multidimensional array in which im sorting this way right now:
function cmp($a, $B)
{
$c = preg_replace('#(\d+)/(\d+)#','${2}/${1}', $a[0]);
$d = preg_replace('#(\d+)/(\d+)#','${2}/${1}', $b[0]);
return strcasecmp($c, $d);
}
usort($output['aaData'],"cmp");
$output['aaData']=array_reverse($output['aaData']);
$output['aaData'] would be like this
"aaData":
[["004\/2012","<a href=nota_fiscal.php?l_ext=117012360'>117012360<\/a>","Kelly","<a href='indicadorc.php?placa=TSET'>TSET<\/a>","8F","85",85,"293","2],
["004\/2012","<a href=nota_fiscal.php?l_ext=117012356'>117012356<\/a>","Kelly","<a href='indicadorc.php?placa=SLIVER_ADSL2'>SLIVER_ADSL2<\/a>","1C","222",222,"372","2],
...]
hope you guys can help me,
thanks!