Of course I can sort an array sort()
, eliminate duplicates array_unique()
and eliminate blanks array_filter()
. I could do that in three lines, and then repeat those three lines for the ten arrays I have to process.
But I wanted it to be at least slightly elegant, so I tried to combine all three operations. It did work for the first two, then I pushed it too far and applied the sort()
$testArray = sort(array_filter(array_unique($testArray)));
This produced:
Strict Standards: Only variables should be passed by reference
So what would be the most elegant way to accomplish this array processing goal?
Bonus points for helping me understand why it failed.