function _brazilianids_format_cnpj in Brazilian IDs 6
Format the CNPJ number
Parameters
&$cnpj: Number, the CNPJ number
Return value
String, the new CNPJ
3 calls to _brazilianids_format_cnpj()
- brazilianids_field in ./
brazilianids_cck.inc - Implementation of hook_field().
- brazilianids_user in ./
brazilianids.module - Implementation of hook_user().
- _brazilianids_format_cpfcnpj in ./
brazilianids.check.inc - Format the CPF number
File
- ./
brazilianids.check.inc, line 18 - brazilianids.check.inc
Code
function _brazilianids_format_cnpj($cnpj) {
$cnpj = _brazilianids_clean_cpfcnpj($cnpj);
return drupal_substr($cnpj, 0, 2) . '.' . drupal_substr($cnpj, 2, 3) . '.' . drupal_substr($cnpj, 5, 3) . '-' . drupal_substr($cnpj, 8, 4) . '/' . drupal_substr($cnpj, 12, 2);
}