jijihohococo/myanmar-alphabet-sorting

Myanmar Alphabet Sorting for PHP

v3.1 2021-07-30 17:01 UTC

This package is auto-updated.

Last update: 2024-09-24 03:33:50 UTC


README

This library is aimed to sort Myanmar Alphabets (both Unicode and Zawgyi Code) Array in PHP

License

This package is Open Source According to MIT license

Installing Library Via Composer

Firstly, you need to add some data in your repositories of composer.json as shown as below

"repositories": [
        {
            "name": "jijihohococo/myanmar-alphabet-sorting",
            "type": "vcs",
            "url": "git@github.com:jijihohococo/myanmar-alphabet-sorting.git"
        }
    ],

And then, run below code in command line.

composer require jijihohococo/myanmar-alphabet-sorting

Usage

You can sort Myanmar Alphabets like below in ascending order

use JiJiHoHoCoCo\MyanmarAlphabetSorting\Sorting;
$array=[ "က",
"ကား",
"ကိ",
"ကီ",
"ကေ",
"ကု",
"ကူ",
"ကူး",
"ကာ"];
Sorting::ascendingOrder($array);

You can sort Myanmar Alphabets like below in descending order

Sorting::descendingOrder($array);

You can sort Myanmar Alphabets by field name in multi dimensional array with both ascending and descending order.

$multiDimensionalArray=[
['name'=>'ကေကေ',"age"=>'12'],
['name'=>'ကီကီ','age'=>'14'],
['name'=>'ကူးကူး','age'=>'13']
];

Sorting::ascendingMulti($multiDimensionalArray,'name');
Sorting::descendingMulti($multiDimensionalArray,'name');

You can also sort Myanmar Alphabets by field name which might include duplicated value sometimes in multi dimensional array with both ascending and descending order.

$duplicatedMultiDimensionalArray=[
['name'=>'ကေကေ',"age"=>'12'],
['name'=>'ကီကီ','age'=>'14'],
['name'=>'ကူးကူး','age'=>'13'],
['name'=>'ကီကီ','age'=>'20']
];

Sorting::ascendingMulti($duplicatedMultiDimensionalArray,'name');
Sorting::descendingMulti($duplicatedMultiDimensionalArray,'name');

References

https://mcf.org.mm/myanmar-unicode/411-myanmar-code-chart.html

https://jrgraphix.net/r/Unicode/1000-109F

https://my.wiktionary.org/wiki/%E1%80%9D%E1%80%85%E1%80%BA%E1%80%9B%E1%80%BE%E1%80%84%E1%80%BA%E1%80%94%E1%80%9B%E1%80%AE:%E1%80%9E%E1%80%90%E1%80%BA%E1%80%95%E1%80%AF%E1%80%B6

https://unicode.org/charts/PDF/UAA60.pdf

https://my.wikipedia.org/wiki/%E1%80%9D%E1%80%AE%E1%80%80%E1%80%AE%E1%80%95%E1%80%AE%E1%80%B8%E1%80%92%E1%80%AE%E1%80%B8%E1%80%9A%E1%80%AC%E1%80%B8:Font

Hope you enjoy!