There is an array, in PHP. It is setup like so
$array_var = array(array(1,2,3,4), array(5,6,7,8), array(3,5,3,9));
This array is from a csv file obtained using the fgetcsv function. If I was to echo out the array properly to display its contents I would make it so it shows like this:
field1 field2 field3 field4
1 2 3 4
5 6 7 8
3 5 3 9
etc etc..
Now I want to sort this array. But I want to sort only one of the columns in all of the arrays. Put another way, and for example, I want to take every third value in every array inside the main array and list them ascendingly, alphabetically. So for a specific case, we would take every value in field3, from the above table, and sort it. And also make it so that the end result of the sort will rearrange the columns so that they are correctly lined up with their values.
End result
field1 field2 field3 field4
1 2 3 4
3 5 3 9
5 6 7 8
etc etc..
How can this be accomplished?
The reason for the challenge is I am trying to remove duplicates from a single column in a csv file. I think the fastest way to do it is to sort the values and look for matches in range.