|
Posted by Erwin Moller on 10/25/12 11:33
Ewoud Dronkert wrote:
> Erwin Moller wrote:
>> Move every element in your array to a new array
>
> Why? Just apply uksort to $val (the 2nd level array).
Hi Ewoud,
Yes, you are right.
The situation I was describing was an array with a complex structure per
element that it contained (more arrays actually, but complex sounds so
great).
The underlying arraystructure differed from element to element.
For some stupid reason I thought the function called by uksort could only
operate on single simple values, which turned out to be nonsense.
(I guess I guessed wrong, based on my experiences with Java, where that
logic is just implemented a little differently for sorting.)
I reread the uksort-function, and the function used just receives the
elements, which can be used to look deeper into their arrays.
Anyway, I got it now.
I will be using uksort a lot more now, so thanks.
You just made my life a little easier (and my code a little faster).
:-)
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|