I have a multiple array that is also associative.But I want to sort multidimensional array by value.Here I want sort this array by its position. You know default php function have methods which only sort one dimensional array not multidimensional array.So for that I have created a function which will give the result to sort multidimensional array by value.Here is the user defined function to sort multidimensional array in php as there is no default function to sort multidimensional array

for example:

call sort function:

In the above example I have the function called “arrayOrderBy” and ‘position’ and ‘name’ is the keys and the values for position’s are 5,2,3,2,1,4.If I use the function “arrayOrderby” to sort multidimenisonal array by value then the result will be like :1,2,2,3,4,5 if it is ascending and 5,4,3,2,2,1 if it is descending.

sort multidimensional array by value
sort multidimensional array by value

Sort multidimensional array by value
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *