Hey im having issues with sorting an array, i chose to use a 2d array a long time ago and im trying to update my site however when i turn the 2d array into a 3d array and try to use array_multisort my values change.
i was using :
array_push($array, $doc[_id], $Fitness);
//but now want to use this
array_push($array, $doc[_id], $Fitness,$title);
The problem with including the title is that it seems to skew the results later when i sort the array:
array_multisort($array); //sort the results to get highest
Is there anyway i can sort the entire array and its contents just by the order of fitness $fitness?
I tried :
array_multisort($results,$Fitness); //sort the results to get highest
but had no luck, do i really have to extract all the values like this? As it seems somewhat overly complicated as a solution...:
foreach ($array as $key => $row) {
$Fitness[$key] = $row['Fitness'];
}
//and then
array_multisort( $Fitness, SORT_ASC, $array);
Any help would be appreciated.