Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multi-dimentional array sorts

    I have 2 associative arrays, "hostids" and "hardware". Here are code snippets to show the structure:

    $hostids[$hostid][date]=$date;

    $hardware[$hostid][name]=$name;

    I want to sort the hostids array based on the alphabetic name from the hardware array. If necessary I can ensure that the 2 arrays have the same hostid keys but it would be even better if it handled a situation where a hostid was missing from one of the arrays. Is this just too convoluted?

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    You're looking for array_multisort().
    John


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •