The original is based on the user input of the digital judgment and then converted to the desired capital number, if we first put the case of an array, and then judge the conversion is OK.
$data = $_post[' RMB '];
if (!ereg ("^[0-9.]", $data)) Die (' Please enter a numeric value! ');
$arr = Array (' 0 ', ' one ', ' II ', ' three ', ' Restaurant ', ' Wu ', ' Lu ', ' qi ', ' ba ', ' JIU ');
$arr 2 = Array (0=> ',1=> ' ten ',2=> ' hundred ',3=> ' thousand ',4=> ' million ',5=> ' ten ',6=> ' hundred ',7=> ' thousand ',8=> ' billion ',9=> ' ten ') ,10=> ' hundred ',11=> ' thousand ');
$len 1 = strlen ($int);//To determine the number of digits
$arrlen = Array ();
For ($i =1 $i <= $len 1; $i + +) {
$sublen = substr ($int, $i -1,1);
$arra [' value '] = $sublen;
$arra [' len '] = $len 1-$i +1;
Array_push ($arrlen, $arra);
}
For ($j =0 $j <= $len 1; $j + +) {
$va = $arrlen [$j] [' Value '];//RMB value]
$valen = $arrlen [$j] [' len '];//length determination unit
switch ($VC = = $va)
{
Case 0:echo $arr [0];break;case 1:echo $arr [1];break;
Case 2:echo $arr [2];break;case 3:echo $arr [3];break;
Case 4:echo $arr [4];break;case 5:echo $arr [5];break;
Case 6:echo $arr [6];break;case 7:echo $arr [7];break;
Case 8:echo $arr [8];break;case 9:echo $arr [9];break;
}
?>
<form id= "Form1" Name= "Form1" method= "Post" action= "" >
<input type= "text" Name= "RMB" id= "RMB"/>
<input type= "Submit" name= "button" id= "button" value= "Convert"/>
</form>