GithubHelp home page GithubHelp logo

tum18860 / php-baht_text Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ponlawat-w/php-baht_text

0.0 0.0 0.0 4 KB

แปลงจำนวนเงินบาทให้เป็นข้อความ | The function converts a number into Thai text with Baht currency format.

PHP 100.00%

php-baht_text's Introduction

php-baht_text

ฟังก์ชัน baht_text ใช้สำหรับแปลงจำนวนเงินให้เป็นข้อความ ในภาษา PHP

baht_text is a PHP function that converts a number into Thai text with baht currency format (as BAHTTEXT() function in Excel).

พารามีเตอร์

  1. double|int $number - จำนวนเงิน
  2. bool $include_unit - เพิ่มหน่วยบาท/สตางค์หรือไม่ (ค่าเริ่มต้น: true)
  3. bool $display_zero - แสดงผลข้อความสำหรับเลข 0 หรือไม่ เช่น ศูนย์บาทถ้วน (ค่าเริ่มต้น: true)

การคืนค่า

จะคืนค่าเป็น string ของข้อความจำนวนเงินที่แปลงแล้ว แต่หากอินพุตไม่ใช่ตัวเลขจะคืนค่าเป็น null

ตัวอย่าง

ตัวอย่าง 1

echo baht_text(54627); // ห้าหมื่นสี่พันหกร้อยยี่สิบเจ็ดบาทถ้วน

ตัวอย่าง 2

echo baht_text('361.75'); // สามร้อยหกสิบเอ็ดบาทเจ็ดสิบห้าสตางค์

ตัวอย่าง 3

echo baht_text(5001, false); // ห้าพันหนึ่ง

ตัวอย่าง 4

echo baht_text(532729.78, false); // ห้าแสนสามหมื่นสองพันเจ็ดร้อยยี่สิบเก้าจุดเจ็ดแปด

ตัวอย่าง 5

var_dump(baht_text('500a')); // NULL

php-baht_text's People

Contributors

cbnuke avatar izcream avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.