Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

getIdType

elcapo edited this page Oct 16, 2014 · 2 revisions

getIdType returns a description of the type of the given document number. When possible, the description has been taken from an official source. In all cases, the returned string will be in Spanish.

Usage

/* MySQL */
SELECT getIdType( 'Q2085360B' ); /* Returns Organismo público */
SELECT getIdType( 'A60496296' ); /* Returns Sociedad Anónima */
/* JavaScript */
var type = getIdType( 'Q2085360B' ); /* type = Organismo público */
var type = getIdType( 'A60496296' ); /* type =  Sociedad Anónima */
/* PHP */
$type = getIdType( 'Q2085360B' ); /* $type = Organismo público */
$type = getIdType( 'A60496296' ); /* $type =  Sociedad Anónima */

Return values

  • [string] - Spanish description corresponding to the document type of the given string.
  • [empty] - If the given number doesn't math a NIF, NIE or CIF pattern, returns an empty string.

Dependencies

In order to verify the format of the string received as parameter, this function uses isValidNIFFormat, isValidNIEFormat and isValidCIFFormat.

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