I have an base array
$base =array(
"A1" =array();
"A2" =array();
"A3" =array();
"A4" =array();
);
and array of condition will use to sort
$condition = array("A1" => "SORT_ASC",
"A4" => 'SORT_ASC',
"A3" => 'SORT_DESC'
);
I tried create a function like this to return a array_multi_sort
function sort_by_condition($condition) {
return array_multisort(
$base['A1'], SORT_ASC, SORT_STRING,
$base['A4'], SORT_ASC,SORT_NUMERIC,
$base['A3'], SORT_DESC,SORT_NUMERIC,
$base['A2'],//default
);
}
But I dont know how can I return something like this?
array_multisort()does not return an array -- it modifies by reference. This question is low-quality because we do not have a minimal reproducible example.