I want to sort my array based on the number of users. At least like. After completing the loop I get down the price
Array ([0] = & gt; Array ([name] = & gt; test1 [points_of_usrs] = & gt; 182 [menu] = & gt; 8f7036bce1f02648eea38b71ded64aea_medium .jpg) [1] = & gt; array ([name] = & gt; test [points_of_usrs] = & gt; 1095 [menu] = & gt; d3644f378eae3675e67b50b44a2fe4ab_medium.jpg) [2] = & gt ; array ([name] = & gt; test2 [points_of_usrs] = & gt; 10 [menu] = & gt;))
and I array like below
Array ([0] = & gt; array ([name] => test [points_of_usrs] => 1095 [avatar] => d3644f378eae3675e67b50b44a2fe4ab_medium.jpg) [1] ] = & Gt; array ([name] => test1 [points_of_usrs] = & Gt; 182 [menu] = & gt; 8f7036bce1f02648eea38b71ded64aea_medium.jpg) [2] = & gt; Array ([name] = & gt; test2 [points_of_usrs] = & gt; 10 [menu] = & gt;)) Sort by function (pcode)
function sortit ($ in. A $ b) {if ($ e & gt; Point_of_usrs == $ b & gt; Point_of_usr) returns 0; And return ($ a-> digits_off_source - $ b-> digits_of_user}} usort ($ array, "sortit");