php - strcoll() expects parameter 1 to be string in uasort() -
i need sort array contains strings different languages. best way found following:
setlocale(lc_collate, 'tr_tr.utf8'); // or other locale use. uasort($ainput['values'],'strcoll');
even though uasort works perfectly, has problems integers , shows warning:
strcoll() expects parameter 1 string
should loop whole array , cast integer values string before calling uasort or there other way?
you can try sort multi-dimensional using locale settings.
array_multisort($ainput['values'], sort_locale_string);
Comments
Post a Comment