Forum Discussion

Huy Pham's avatar
Huy Pham
Copper Contributor
Nov 22, 2017

How to sort Japanese like Excel

want to sort Japanese words ( Kanji) like sort feature in excel. I have tried many ways to sort Japanese text in PHP but the result is not 100% like result in excel.

First . I tried to convert Kanji to Katakana by using this lib (https://osdn.net/projects/igo-php/) but some case is not same like excel. I want to sort these words ASC

けやきの家

高森台病院

みのりの里

My Result :

けやきの家

高森台病院

みのりの里

Excel Result:

けやきの家

みのりの里

高森台病院

Second I tried other way by using this function

 mb_convert_kana($text, "KVc", "utf-8");

The sorting result is correct with those text above, but it contain some case not correct

米田病院

米田病院

高森台病院

My result :

米田病院

米田病院

高森台病院

Excel Result:

高森台病院

米田病院

米田病院

Do you guys have any idea about this. (Sorry for my English ) . Thank you

No RepliesBe the first to reply

Resources