OK...
I have a multidimensional array...
Like this...
$output[0][0] = 111;
$output[0][1] = 'Joe';
$output[0][2] = 'Blow';
$output[1][0] = 112;
$output[1][1] = 'Jane';
$output[1][2] = 'Doe';
And so on...
I can get the array to display in a table with no problems...
Now what I want it to do is order the table by Last Name which is in the following location...
// If $i is the current 'row' being displayed...
$output[$i][2] = "Last Name";
I found the following function in Php.net but cannot get it to work...
function multisort(&$array, $sortby, $order='ASC') {
$order_s = SORT_DESC;
if ($order == 'ASC') {
$order_s = SORT_ASC;
}
if (!isset($array -> $sortby))
return;
asort($array->$sortby, $order_s);
$sorting = array();
foreach ($array -> $sortby as $key => $val) {
$sorting[] = $key;
}
foreach ($array as $key => $val) {
//sort key
$valaux = array();
for($i=0; $i<count($sorting); $i++) {
$valaux[] = $val[$sorting[$i]];
}
$array->$key = $valaux;
}
}
I copied and pasted this into my code and used the following to call the function...
// Lets see if this function works
multisort($output, 3, 'DESC');
When I run the page, nothing changes...
I still get the same order...
At least it doesn't just give me a blank page...!
Can anyone see what I'm doing wrong here...?
Any help would be greatly appreciated...!!!!!!