天天看點

php 十六進制累加校驗碼

生成十六進制累加校驗碼

function getcheckcode($data){
    if($data){
		$arr = array();
		$arr = str_split($data, 2);
		$result = 0;
		for ($i=0; $i < count($arr); $i++) {
			$result =$result + hexdec($arr[$i]);
		}
        $result = strtoupper('0'.dechex($result)); //轉換成大寫
        return $result;
	}
}
           
php 十六進制累加校驗碼

如果有什麼問題及不懂的可以于關注公衆号 

php 十六進制累加校驗碼

回複999加我微信交流下 

php