Home  >  Article  >  php教程  >  php 阿拉伯数字转中文汉字

php 阿拉伯数字转中文汉字

PHP中文网
PHP中文网Original
2016-05-23 16:38:491606browse


 //去掉数字段前面的0 
function del0($num){ 
	return "".intval($num); 
} 
//单个数字变汉字
function n2c($x){ 
	$arr_n = array("零","一","二","三","四","五","六","七","八","九","十"); 
	return $arr_n[$x]; 
} 
//读取数值(4位)
function num_r($abcd)
{ 
	$arr= array(); 
	$str = ""; //读取后的汉字数值 
	$flag = 0; //该位是否为零 
	$flag_end = 1; //是否以“零”结尾 
	$size_r = strlen($abcd); 
	for($i=0; $i<$size_r; $i++){ 
		$arr[$i] = $abcd{$i}; 
	} 
	$arrlen = count($arr); 
	for($j=0; $j

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn