Posted by Balaskas Evaggelos on 12/17/23 11:56
gbbulldog@googlemail.com wrote:
> Balaskas Evaggelos wrote:
>> Hi,
>>
>> does anyone know how i can sort a multi-dimensional array
>> by a specific field ?
>>
>> for example i want to sort arr[m][n] where n=2,
>> but i need the data of every array to follow that order.
>>
>> example array:
>> arr[0][0]
>> arr[0][1]
>> arr[0][2]
>> arr[0][3]
>> arr[0][4]
>> arr[0][5]
>>
>> arr[1][0]
>> arr[1][1]
>> arr[1][2]
>> arr[1][3]
>> arr[1][4]
>> arr[1][5]
>
> You can use the array_multisort() function to do this. More info and a
> number of examples of useage can be found at :
> http://uk.php.net/manual/en/function.array-multisort.php
>
thanks for your anwser but the first thing i checked,
before i wrote this post, was that url.
The example are for multi-dimensional array of one-dimensional arrays.
I can't find how i can sort a multi-dimensional array of array[m][n]
and for a specific field example n=2.
[Back to original message]
|