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

Class: Validate_DK

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

Class Overview


Data validation class for Denmark


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • Copyright (C) 2003, 2004 Jesper Veggerby Hansen

Methods


Inherited Variables

Inherited Methods


Class Details

[line 48]
Data validation class for Denmark

This class provides methods to validate:

  • Postal code
  • Social Security Number (CPR Nummer)
  • German bank code
  • Car registration number



[ Top ]


Method Detail

carReg   [line 146]

bool carReg( string $reg)

Validates a car registration number

Format: AA XX YYY

Where AA are 2 letter UPPERCASE A-Z


Parameters:

string   $reg   —  the registration number

[ Top ]

phoneNumber   [line 125]

bool phoneNumber( string $tel)

Validate danish telephone number

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

  • See:
  • Access: public

Parameters:

string   $tel   —  the tel number

[ Top ]

postalCode   [line 61]

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 Thu, 10 Dec 2015 05:35:56 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.