Use array_multisort() with custom function

后端 未结 2 2032
南旧
南旧 2021-01-26 18:46

I have the following array and I would like to sort it according another array and not DESC or ASC

$array = array(
    \'note\' => a         


        
2条回答
  •  暖寄归人
    2021-01-26 19:25

    I think its not possible. Instead of that do like this

    $custom_function_value = custom_function();
    array_multisort($array['type'], $array['year'], $custom_function_value, $array['note']);
    

    I think this will give your desired output.

提交回复
热议问题