วันจันทร์ที่ 9 เมษายน พ.ศ. 2555
แปลงจำนวนเงินเป็นตัวอักษร ไทยและอังกฤษ
เจอ class แปลงจำนวนเงินเป็นตัวอักษร ไทยและอังกฤษ ดีๆๆมาแบ่งกันใช้ครับ
<?php
// bin/class.currency.php
// class Currency โดย http://www.goragod.com (กรกฎ วิริยะ)
// สงวนลิขสิทธ์ ห้ามซื้อขาย ให้นำไปใช้ได้ฟรีเท่านั้น
class Currency {
public function bahtEng($thb) {
list($thb, $ths) = explode('.', $thb);
$ths = substr($ths.'00', 0, 2);
$thb = Currency::engFormat(intval($thb)).' Baht';
if (intval($ths) > 0) {
$thb .= ' and '.Currency::engFormat(intval($ths)).' Satang';
}
return $thb;
}
สมัครสมาชิก:
บทความ (Atom)