Source for file ES.php
Documentation is available at ES.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 Pierre-Alain Joye,Tomas V.V.Cox |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled |
// | with this package in the file LICENSE, and is available through |
// | the world-wide-web at |
// | http://www.opensource.org/licenses/bsd-license.php |
// | If you did not receive a copy of the new BSDlicense and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | pajoye@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Tomas V.V.Cox <cox@idecnet.com> |
// | Pierre-Alain Joye <pajoye@php.net> |
// | Byron Adams <byron.adams54@gmail.com>
// +----------------------------------------------------------------------+
* Specific validation methods for data used in Spain
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Byron Adams <byron.adams54@gmail.com>
* @copyright 1997-2005 Pierre-Alain Joye,Tomas V.V.Cox
* @copyright (c) 2006 Byron Adams
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: ES.php,v 1.13 2006/08/25 08:07:43 badams Exp $
* @link http://pear.php.net/package/Validate_ES
* Requires base class Validate
require_once 'Validate.php';
* Data validation class for Spain
* This class provides methods to validate:
* - Spanish DNI number ("El documento de la identificación nacional")
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Byron Adams <byron.adams54@gmail.com>
* @copyright 1997-2005 Pierre-Alain Joye, Tomas V.V.Cox
* @copyright (c) 2006 Byron Adams
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version Release: @package_version@
* @link http://pear.php.net/package/Validate_ES
* Validate Spanish DNI number ("El documento de la identificación nacional")
* In Spain, all Spanish citizens are issued with a DNI
* the numbers are used as identification for almost all purposes.
* @param string $dni El Documento Nacional de Indentidad a chequear
* @return bool returns true on success false otherwise
* @author Tomas V.V.Cox <cox@idecnet.com>
* @author Byron Adams <byron.adams54@gmail.com>
* @link http://es.wikipedia.org/wiki/Algoritmo_para_obtener_la_letra_del_NIF
* @link http://nationalidentificationnumber.quickseek.com/#Spain
$letters = 'TRWAGMYFPDXBNJZSQVHLCKET';
$number = substr($dni,$start,-1 );
return ($letter == $letters{$number % 23 });
Documentation generated on Fri, 05 Jun 2009 08:00:02 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.
|