PHP code example of recca / chinese-military-number

1. Go to this page and download the library: Download recca/chinese-military-number 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/ */

    

recca / chinese-military-number example snippets


$chineseMilitaryNumber = new Recca\ChineseMilitaryNumber();
echo $chineseMilitaryNumber->format('0912'); // 洞勾么兩

$chineseMilitaryTime = new Recca\ChineseMilitaryTime();
$time = Carbon::create(2025, 1, 1, 9, 17, 0);
echo $chineseMilitaryTime->fromCarbon($time); // 洞勾么拐

// 假設現在時間 12:00
$chineseMilitaryTime = new Recca\ChineseMilitaryTime();
echo $chineseMilitaryTime->now(); // 么兩洞洞