Hi all,
I have an array i'm capturing from a textarea on a form.
Each line has this format:
varA (space) varB|varC
I'm trying to ensure that this array is sorted by VarB DESC before I place it into a text file.
Here what I have:
$array = split("\n",$listItems);
$count = count($array);
for ($x = 0;$x<$count; $x++) {
list($varX,$varC) = split("\|",$array[$x]);
list($varA,$varB) = split(" ",$varX);
}
$sortedArray = array_multisort($varB,SORT_STRING,SORT_DESC, $varA,$varC);
echo $sortedArray;
Of course this doesn't work (the multisort part). I am splitting my elements the way I need to so that's not the issue.
Some of the examples I've seen have the array_multisort() inside the for loop. I can't get it to work.
Can someone point me in the right direction please?
Thanks!