php - usort or array_multisort?

Posted by Simpson88Keys on Stack Overflow See other posts from Stack Overflow or by Simpson88Keys
Published on 2010-06-10T11:37:40Z Indexed on 2010/06/10 11:53 UTC
Read the original article Hit count: 290

Filed under:
|

Trying to sort the array below by memnum in ascending order, and I'm a bit confused which is better to use... usort or array_multisort? I was thinking usort because it's multidimensional? Does anyone have an example of this?

Array
(
    [0] => Array
        (
            [memnum] => 3236467423
            [mid] => 1104881300  
            [fname] => JOHN        
            [lname] => DOE                 
            [add1] =>  OMITTED
            [add2] =>             
            [city] => CHESTERFIELD      
            [state] => MI
            [zip] => 48051
            [age] => 50 
        )
    [1] => Array
        (
            [memnum] => 3258467922
            [mid] => 1105121457  
            [fname] => JANE        
            [lname] => DOE                 
            [add1] =>  OMITTED
            [add2] =>             
            [city] => CHESTERFIELD      
            [state] => MI
            [zip] => 48051
            [age] => 50 
        )
    [2] => Array
        (
            [memnum] => 3237769108
            [mid] => 1104489312  
            [fname] => BOB        
            [lname] => DOE                 
            [add1] =>  OMITTED
            [add2] =>             
            [city] => CHESTERFIELD      
            [state] => MI
            [zip] => 48051
            [age] => 50 
        )
)

© Stack Overflow or respective owner

Related posts about php

Related posts about multidimensional-array