Results 1 to 1 of 1
2011-02-01, 09:44 #1
- Join Date
- Mar 2002
- Sacramento, California, USA
- Thanked 1 Time in 1 Post
PHP: calling usort from a class function
I need to call usort from a class function, and I'm puzzled about how to define the comparison function.
I've tried to define the comparison function in the same class, but I can't get usort to call it. I found one hint that it will work if I make the comparison function static, but I tried that, and it didn't work for me.
If I define the comparison function outside the class, it won't have access to object properties that it needs to operate.
The only solution I can think of is to define the comparison function outside the class and put the object properties it needs in globals. Is there a cleaner way to do this?