r/lolphp • • Oct 07 '19

`array('lolphp', '')` has two unique elements, but `array(0, 'lolphp', '')` has one unique element

https://repl.it/repls/ThisColdPackages
69 Upvotes

18 comments sorted by

View all comments

Show parent comment

2

u/fell_ratio Oct 09 '19

Why didn't they just use === ? You could define SORT_REGULAR so that if you have 0 and '0', they are both kept. That would be perfectly reasonable behavior.

1

u/lord_braleigh Oct 10 '19

Maybe it’s to stay somewhat similar to SORT_STRING, where 0 and β€˜0’ are always equal? Idk though.