Softpedia
 


SCRIPTS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Peardrop CMS 0.2.3
  • CommaFeed 0.0.1
  • Squash
  • Pick-a-Color 1.1.5
  • MVIS Security Center 1....
  • EasyZoom 1.0.3
  • jQueryGantt
  • IMDBPHP 2.1.8
  • Dynamic WordPress Form ...
  • PathFinding.js 0.4.1
  • Home > Scripts > Snippets

    Sort multiple dimensional arrays by column 2008-09-12

    download button


    Downloads: 1,107  Tell us about an update
    User Rating:
    Rated by:
    Good (3.2/5)
    22 user(s)
    Developer:

    Website:

    License / Price:

    Platforms:

    Databases:

    Language:

    Last Updated:

    Category:
    Richard Quadling | More scripts
    snippets.dzone.com
    Other Free / Open Source License 

    Windows / Linux / Mac OS / BSD / Solaris
    N/A
    PHP
    January 14th, 2009, 11:50 GMT [view history]
    C: \ Snippets

     Read user reviews (0)  Refer to a friend  Subscribe

    Sort multiple dimensional arrays by column description

    This PHP snippet provides mechanism to sort multidimensional data by columns without the need to extract the column data first.

    The syntax used is the same as of array_multisort().

    If your array does not have associated indexes, then you can use column numbers.

    If you also use PHP's constants like SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC or SORT_STRING, then these can be mixed up with column numbers.

    So, to remove this problem, copies of these constants exist:
    AMC_SORT_ASC
    AMC_SORT_DESC
    AMC_SORT_REGULAR
    AMC_SORT_NUMERIC
    AMC_SORT_STRING

    Other than that, these function work together JUST like array_multisort but sorts using column(s) without the need to first extract the columns into individual arrays.

    Here are some key features of "Sort multiple dimensional arrays by column":

    · AMC_SORT_STRING_CASELESS to sort the strings case insensitively.
    · AMC_LOSE_ASSOCIATION (the default behaviour) to lose the associations for the array.
    · AMC_KEEP_ASSOCIATION to keep the associations for the array.

    What's New in This Release: [ read full changelog ]

    · Minor modification to not do any work if the array being sorted is empty.



    TAGS:

    multi-dimensional arrays | array sorting | column sort | sorting | data | multi-dimensional

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM