You are viewing a single comment's thread from:
RE: PHP: Use associative arrays basically never
Interesting observation! If you're sorting an array, yes, that would make a big difference. However, the purpose of usort()
here was to provide a direct comparison between objects and arrays, so they had to be used in the same way. That meant usort()
so that we could compare the property access in each. I didn't as much care about the sorting itself as sorting was an easy way to call $array['a']
and $object->a
a few zillion times. :-)