Skip to content
elcapo edited this page Oct 16, 2014 · 5 revisions

isValidCIF validates the check digits of an identification number, after verifying the string structure actually fits the CIF pattern.

Usage

/* MySQL */
SELECT isValidCIF( 'C4090266J' ); /* Returns 1 */
SELECT isValidCIF( 'C4090266X' ); /* Returns 0 */
/* JavaScript */
var isValid = isValidCIF( 'C4090266J' ); /* isValid = 1 */
var isValid = isValidCIF( 'C4090266X' ); /* isValid = 0 */
/* PHP */
$isValid = isValidCIF( 'C4090266J' ); /* $isValid = 1 */
$isValid = isValidCIF( 'C4090266X' ); /* $isValid = 0 */

Return values

  • 1 - If specified CIF is correct.
  • 0 - Otherwise.

Dependencies

In order to verify the format of the string received as parameter, this function uses isValidCIFFormat. In order to check the written digit and compare it with the correct one, it uses getCIFCheckDigit.

Category

This function is part of the NIF, NIE & CIF package.

SEPA validations

  • [International Bank Account Numbers (IBAN)](International Bank Account Numbers (IBAN))

Spanish validations

Helpers

  • [Common functions](Common functions)
Clone this wiki locally