I assume this is supposed to be a sort_custom()
function for an Array
(as documented here)?
If so, the docs show the function should be static
.
Using your function as-is seems to work for me - after making it static. However, I don't really understand what you're doing.
You seem to be trying to sort an Array
of Array
's that contain some sort of object that has get_height()
and get_width()
functions (such as an Image
).
Further, you're basing the sort decision on get_height()
and get_width()
results of the 2nd element in the array. Again, not sure of the intention here, but the above does seem to work for me (or, at least generates a modified order for my random array and does not generate the error you reported).
If the above doesn't help, perhaps a more detailed explanation, along with some more code that shows how you're setting up and calling the custom sort.