No announcement yet.

sort a 2D array?

  • Filter
  • Time
  • Show
Clear All
new posts

    sort a 2D array?

    I haven't needed to sort an array in a while and not getting results for some reason with current sorting functions. Probably a simple thing, but not sure what.

    My array is rows and columns(about 15). I need to have the returned array sorted by the first column, ie: myarray[x][1], ascending or descending. If values of the first column match (uppercase equals lower case) it doesn't matter which row is listed first. The actual need is to make sure that if there are 5 rows of the same value in the 1st column they are returned in the array in the same sequential block of 5.

    I did think the array_sort_by method would work, It didn't probably because the column index isn't an array member.

    What is my solution?


    Need to offer Shipping Insurance?
    Interactive Design Solutions
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    This should help:
    Kent Multer
    Magic Metal Productions
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line: