i want to sort an multi-array by date, but it's a bit particular. there are two type of entries in the array :
if array[i][0] == 'note' then the date is array[i][7]
if array[i][0] == 'activity' then the date is array[i][5]
is it possible to do that with array_multisort?
first you need to make a keyarray for dates
$name_key = array();
for($a=0 ; a<count($array);$a++)
{
if(array[$a][0]=='note')
$name_key[$a] = array[$a][7];
}
elseif(array[$a][0]=='activity'){
$name_key[$a] = array[$a][5];
}
then you need to multisort according to it
array_multisort($array,SORT_ASC,$name_key);