Validate_DK
[ class tree: Validate_DK ] [ index: Validate_DK ] [ all elements ]

Class: Validate_DK

Source Location: /Validate_DK-0.2.0/Validate/DK.php

Class Overview


Data validation class for Denmark


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2005 Jesper Veggerby Hansen

Methods


Inherited Variables

Inherited Methods


Class Details

[line 44]
Data validation class for Denmark

This class provides methods to validate:

  • Postal code
  • Social Security Number (CPR Nummer)
  • Danish telephone number
  • Car registration number



[ Top ]


Method Detail

carReg   [line 145]

bool carReg( string $reg)

Validates a car registration number

Format: AA XX YYY

Where AA are 2 letter UPPERCASE A-Z

  • Access: public

Parameters:

string   $reg     the registration number

[ Top ]

phoneNumber   [line 123]

bool phoneNumber( string $tel)

Validate danish telephone number

Simple check: 8 digits when removing (, ), -, +, ., ' '

  • Access: public

Parameters:

string   $tel     the tel number

[ Top ]

postalCode   [line 59]

bool postalCode( string $postcode, [bool $strong = false])

validates a postcode

Four digit postal code, maybe with a leading 'DK-'

  • Access: public

Parameters:

string   $postcode     the postcode to be validated
bool   $strong     optional; strong checks (e.g. against a list of postcodes)

[ Top ]

ssn   [line 86]

bool ssn( string $cpr, [string $gender = false])

validates a CPR Number (ssn equiv)

The danish CPR number is a 8 digit number with the birthdate as ddmmyy-xxxy where xxxy is a four digit control number.

The 10 digits are summarized with coefficients 4, 3, 2, 7, 6, 5, 4, 3, 2 and 1. If the sum is divisible by 11 the control is correct.

The last digit of the control number (y) is also dependend on gender, if y is odd it's a male cpr number and if even a female.

  • Access: public

Parameters:

string   $cpr     CPR number
string   $gender     The gender to validate for 'M' for male, 'F' for female, false or omitted to not perform the check.

[ Top ]


Documentation generated on Sat, 17 Dec 2011 14:00:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.