I am trying to sort an array on the base of its child array using array_multisort()
function......
While trying;
print_r($mar); echo '<br>';
$arr2 = array_multisort($mar, array('wek'=>SORT_ASC));
print_r($arr2);
getting error array_multisort(): Array sizes are inconsistent
the output before sorting is
Array (
[0] => Array ( [dat] => 1 [wek] => 5 [mac] => A100 [mcr] => #00c8ff )
[1] => Array ( [dat] => 2 [wek] => 9 [mac] => A100 [mcr] => #00c8ff )
[2] => Array ( [dat] => 5 [wek] => 13 [mac] => A100 [mcr] => #00c8ff )
[3] => Array ( [dat] => 5 [wek] => 6 [mac] => A101 [mcr] => #ff8800 )
[4] => Array ( [dat] => 13 [wek] => 17 [mac] => A100 [mcr] => #00c8ff )
[5] => Array ( [dat] => 20 [wek] => 21 [mac] => A100 [mcr] => #00c8ff )
[6] => Array ( [dat] => 8 [wek] => 14 [mac] => A101 [mcr] => #ff8800 )
)
What i need is:
Array (
[0] => Array ( [dat] => 1 [wek] => 5 [mac] => A100 [mcr] => #00c8ff )
[3] => Array ( [dat] => 5 [wek] => 6 [mac] => A101 [mcr] => #ff8800 )
[1] => Array ( [dat] => 2 [wek] => 9 [mac] => A100 [mcr] => #00c8ff )
[2] => Array ( [dat] => 5 [wek] => 13 [mac] => A100 [mcr] => #00c8ff )
[6] => Array ( [dat] => 8 [wek] => 14 [mac] => A101 [mcr] => #ff8800 )
[4] => Array ( [dat] => 13 [wek] => 17 [mac] => A100 [mcr] => #00c8ff )
[5] => Array ( [dat] => 20 [wek] => 21 [mac] => A100 [mcr] => #00c8ff )
)