Hi,
I'm using array_multisort to sort my multidim array, but,when I do, I lose index 0 of my array.
say my array is:
$nodes[0]=array("id"=>"32","order"=>1);
$nodes[1]=array("id"=>"24","order"=>2);
$nodes[2]=array("id"=>"25","order"=>4);
$nodes[5]=array("id"=>"12","order"=>6);
I know I skipped $nodes[4], but that can happen when the client removes a node in the database. When I use the following:
for($i = 0; $i < sizeof($nodes); $i++){
$sortarray[] = $nodes[$i]['id'];
}
array_multisort($sortarray,$nodes);
I lose $nodes[0] during the array_multisort. A print_r of $sortarray and $nodes (before and after the array_multisort) reveals this. I've seen others on this list implement this without problems. I ended up using $sortarray for the ids. It's a kluge, but it gets the job done. I'd rather use the original array that I've sorted, though.
Thanks,
Biggus