Home > php教程 > PHP源码 > php 阿拉伯数字转中文汉字

php 阿拉伯数字转中文汉字

PHP中文网
Release: 2016-05-23 16:38:49
Original
1727 people have browsed it


 //去掉数字段前面的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
Copy after login

                   

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template