php通过身份证判断性别


/**

已测试,百度很多写法不行的
 * 1就是男性 2就是女性
* 通过身份证获取性别类型
* @param type $card
* @return int
*/
function getCardSex($idcard) {
 if(empty($idcard)) return null;
    $sexint = (int) substr($idcard, 16, 1);
    return $sexint % 2 === 0 ? '2' : '1';
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM