Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


how do i sort a php array by an element nested inside using -'php,arrays,sorting,multidimensional-array,usort'


how do i sort a php array by an element nested inside  using -'php,arrays,sorting,multidimensional-array,usort'

I have an array like the following:


Array
(
    [0] => Array
        (
            'name' => "Friday"
            'weight' => 6
        )
    [1] => Array
        (
            'name' => "Monday"
            'weight' => 2
        )
)


I would like to grab the last values in that array (the 'weight'), and use that to sort the main array elements. So, in this array, I'd want to sort it so the 'Monday' element appears before the 'Friday' element.
    

asked Sep 8, 2015 by rajesh
0 votes
6 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...