Php determines the region (province) address based on the ID card number
Php determines the region (mainly the province or municipality) based on the ID card number and the detailed address of the district/county. The Code is as follows:
<? Php/*** calculate the province and detailed district/county address based on the id card */class addr {/** obtain the province **/public static function getProvince ($ id) {// intercept the first two digits $ index = substr ($ id,); $ area = array (11 => "Beijing", 12 => "Tianjin ", 13 => "Hebei ",......); return $ area [$ index];}/** get address **/public static function getAddress ($ id) {$ index = substr ($ id ); $ areaArray ['000000'] = 'datong city, Shanxi Province '; $ areaArray ['000000'] = 'datong City mining area, Shanxi Province '; $ areaArray ['000000'] = 'Southern suburb of Datong City, Shanxi Province ';...... return $ areaArray [$ index] ;}}
For the complete code, click Download below:
Addr. class. php