I'm working in PHP CodeIgniter framework. Here I have an array with values distance field is in all the array. So I want to sort this array based on distance variable. when the distance is small it should be show at the top of the array.
Array
(
[3] => Array
(
[distance] => 0.1867701321678877
[search_name] => gshshs
[type] => vendor
)
[4] => Array
(
[distance] => 0.2581692930636528
[search_name] => imarahtech
[type] => vendor
)
[5] => Array
(
[distance] => 13.022316349008124
[delivery_available] => Yes
[search_name] => mius
[type] => vendor
)
[6] => Array
(
[distance] => 23.49767368340837
[search_name] => imarahtech
[type] => vendor
)
[7] => Array
(
[distance] => 37.85888922426821
[search_name] => blu
[type] => vendor
)
[8] => Array
(
[distance] => 0.18766008198496642
[search_name] => fried rice
[type] => product
)
[14] => Array
(
[distance] => 13.022316349008124
[search_name] => meals rice
[type] => product
)
[15] => Array
(
[distance] => 37.85888922426821
[search_name] => ayla
[type] => product
)
)
so here what I wanted, Show the data Ascending order.
Output
Array
(
[3] => Array
(
[distance] => 0.1867701321678877
[search_name] => gshshs
[type] => vendor
)
[8] => Array
(
[distance] => 0.18766008198496642
[search_name] => fried rice
[type] => product
)
[4] => Array
(
[distance] => 0.2581692930636528
[search_name] => imarahtech
[type] => vendor
)
[5] => Array
(
[distance] => 13.022316349008124
[delivery_available] => Yes
[search_name] => mius
[type] => vendor
)
[14] => Array
(
[distance] => 13.022316349008124
[search_name] => meals rice
[type] => product
)
[6] => Array
(
[distance] => 23.49767368340837
[search_name] => imarahtech
[type] => vendor
)
[7] => Array
(
[distance] => 37.85888922426821
[search_name] => blu
[type] => vendor
)
[15] => Array
(
[distance] => 37.85888922426821
[search_name] => ayla
[type] => product
)
)
Somebody Please help me to overcome this problem.
Thanking You