ฟังชั่น การแปลงตัวเลขอารบิค เป็นตัวเลขไทย ด้วย php
หน้าแรก PHP MySQL เกร็ดความรู้ ฟังชั่น การแปลงตัวเลขอารบิค เป็นตัวเลขไทย ด้วย php
ฟังชั่น การแปลงตัวเลขอารบิค เป็นตัวเลขไทย ด้วย php
| Code |
| <? function webUBcom_ThaiNumber1($n1){ if($n1==1) { $n2="๑";} else if($n1==2) { $n2="๒";} else if($n1==3) { $n2="๓";} else if($n1==4) { $n2="๔";} else if($n1==5) { $n2="๕";} else if($n1==6) { $n2="๖";} else if($n1==7) { $n2="๗";} else if($n1==8) { $n2="๘";} else if($n1==9) { $n2="๘";} else if($n1==0) { $n2="๐";} else { $n2="";} return $n2; } function webUBcom_ThaiNumber2($a){ $b=str_split($a); $d=count($b); for($i=0;$i<$d;$i++){$c.=webUBcom_ThaiNumber1($b[$i]); } return $c; } echo webUBcom_ThaiNumber2(2555); ?> |
ขึ้นไปด้านบน
