You are here

function _brazilianids_format_cpfcnpj in Brazilian IDs 6

Format the CPF number

Parameters

&$cpf: Number, the CPF number

Return value

String, the new CPF

File

./brazilianids.check.inc, line 46
brazilianids.check.inc

Code

function _brazilianids_format_cpfcnpj($cpfcnpj) {
  $cpfcnpj = _brazilianids_clean_cpfcnpj($cpfcnpj);
  if (drupal_strlen($cpfcnpj) == 11) {
    return _brazilianids_format_cpf($cpfcnpj);
  }
  elseif (drupal_strlen($cpfcnpj) == 14) {
    return _brazilianids_format_cnpj($cpfcnpj);
  }
  else {
    return FALSE;
  }
}