PHP code example of konthaina / khmer-format

1. Go to this page and download the library: Download konthaina/khmer-format library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

konthaina / khmer-format example snippets




use KhmerFormat\KhmerTimeFormatter;

echo KhmerTimeFormatter::format("1:22 PM", "digits"); // ម៉ោង១ និង ២២ នាទី រសៀល
echo KhmerTimeFormatter::format("13:22", "words");    // ម៉ោងមួយ និង ម្ភៃពីរ នាទី រសៀល
echo KhmerTimeFormatter::formatNow("digits");
echo KhmerTimeFormatter::formatNow("words", "Asia/Phnom_Penh");

use KhmerFormat\KhmerMoneyFormatter;

echo KhmerMoneyFormatter::formatKHR(15000);              // ១៥,០០០ ៛
echo KhmerMoneyFormatter::formatUSD(15000);              // $15,000.00
echo KhmerMoneyFormatter::toKhmerWordsKHR(15000);        // មួយម៉ឺនប្រាំពាន់ រៀល
echo KhmerMoneyFormatter::toKhmerWordsUSD(15000);        // មួយម៉ឺនប្រាំពាន់ ដុល្លារ
echo KhmerMoneyFormatter::format('KHR', 15000, false);   // 15,000 ៛
echo KhmerMoneyFormatter::format('USD', 15000);          // $15,000.00