array_unique() is perfect for removing duplicates in a string array, but
not so great for an array of objects.
SORT_REGULAR was added to compare items without casting them to string.
However it uses the "==" comparison operator.
I see two improvements:
- on a short term, improve the documentation to make it explicit that
the "==" operator will be used (the example with "(string) $elem1 ===
(string) $elem2" is misleading, "===" should be replaced with "==")
- on a long term, maybe add another option SORT_STRICT (like the $strict
parameter for in_array): that sort would use the strict comparison
operator "==="
Any thoughts about that?
Matthieu
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php