Thanks
This is what i have
<?php
function msort($array, $id="order") {
echo($array);
$temp_array = array();
while(count($array)>0) {
$lowest_id = 0;
$index=0;
foreach ($array as $item) {
if (isset($item[$id]) && $array[$lowest_id][$id]) {
if ($item[$id]<$array[$lowest_id][$id]) {
$lowest_id = $index;
}
}
$index++;
}
$temp_array[] = $array[$lowest_id];
$array = array_merge(array_slice($array, 0,$lowest_id), array_slice($array, $lowest_id+1));
}
return $temp_array;
}
$array_Test = array();
$newArray = array();
$array_Test['TestID'][1] ="1";
$array_Test['Name'][1] = "Joe";
$array_Test['order'][1] ="3";
$array_Test['TestID'][2] ="2";
$array_Test['Name'][2] = "Ana";
$array_Test['order'][2] ="1";
$array_Test['TestID'][3] ="3";
$array_Test['Name'][3] = "Mara";
$array_Test['order'][3] ="2";
$newArray = msort($array_Test);
echo($newArray['Name'][1]); // Should be Ana
echo(" ");
echo($array_Test['Name'][1]);// Should be Joe
?>
For some rason echo($newArray[1]); is not returning anything