Im trying to sort any array with array_multisort and everything is working great. However, based on conditions in my script, I need to change the options. So What I have s
I had the same problem with this answer: "Argument #1 is expected to be an array or a sort flag"
For anyone having the same problem try this instead:
$dynamicSort = array(&$sort1, SORT_ASC, &$sort2, SORT_ASC, &$sort3, SORT_ASC);
$param = array_merge($dynamicSort, array(&$arrayToSort));
call_user_func_array('array_multisort', $param);
Note that i have used the reference to my variables "&$" instead of $. This works great in php 5.3 but may cause error in 5.2 due to a bug.