Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • PHP Sorting Array

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3
    Comment on it

    PHP offers a host of built in functions that we can use for sorting arrays. These functions allow us to sort arrays by key/value or ascending/decending order.

    • a: an prefix a, to function means the function sorts by value but maintains the association between key/value pairs the way it was.
    • k: an prefix k, to function means the function sorts by key but maintains the key/value associations.
    • The lack of k or a means the the function sorts by value but does not maintain the key/value association.
    • r: The prefix r, to function means the sorting order will be reversed.
    • u: The prefix u, to function means that a second argument is expected, the name of the user-defined function that specifies the ordering of any two elements that are being sorted.

                                           
      
      Array Sorting Functions
      -----------------------
      Function                                                  Behavior
      asort()                                                     Takes a single array as argument
      
      

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: