How to sort a multilevel arrays in PHP

28 Views Asked by At

I've read a file of names into an array from a .csv file using fopen(). It gives me an array in the format shown below (I've eliminated most of the fields and trimmed it down to just a few entries for brevity.) I've tried referred to the PHP manual and numerous tutorials and code samples from the Internet and I can't make it work.

There are similar questions on stack exchange for sure, but they present solutions that aren't working for me. I have a suspicion that they're due to the format or my array generated by fopen(), but I can't be sure.

Below is the array I see from print_r() in PHP. I want to sort by last name, then first name.

Array 
(
    [1] => Array
        (
            [0] => Ed,
            [1] => Wilson,
            [2] => Chair
        )

    [2] => Array
        (
            [0] => Bill,
            [1] => Adams,
            [2] => Convenor
        )

    [3] => Array
        (
            [0] => Tom,
            [1] => Deschamps,
            [2] => Treasurer
        )

    [3] => Array
        (
            [0] => Wendell,
            [1] => Adams,
            [2] => Member
        )

)
0

There are 0 best solutions below