Try usort for multidimensional array sorting by specific key value inside each sub array.
Example:
array (size=3) 0 => array (size=3) 'id' => string '137880625719tzdmr' (length=17) 'name' => string 'Retailer1' (length=9) 'value' => string 'A' (length=1) 1 => array (size=3) 'id' => string '137886379776hyups' (length=17) 'name' => string 'Retailer YZ' (length=11) 'value' => string 'b' (length=1) 2 => array (size=3) 'id' => string '137888317905yjrxk' (length=17) 'name' => string 'Retailer Spec' (length=13) 'value' => string 'c' (length=1)
The best way is:
usort(<your array>, function ($elem1, $elem2) { return strcmp( lcfirst($elem1['name']), lcfirst($elem2['name']) ); });
reference:
http://stackoverflow.com/questions/2699086/sort-multidimensional-array-by-value-2
What do you think?