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

Class: Validate_IS

Source Location: /Validate_IS-0.3.1/Validate/IS.php

Class Overview

Data validation class for Iceland



  • Release: @package_version@


  • 2005-2006 Hannes Magnusson


Inherited Variables

Inherited Methods

Class Details

[line 44]
Data validation class for Iceland

This class provides methods to validate:

  • SSN (Social Security Number (Icelandic: kennitala))
  • Postal code (Icelandic: post numer)
  • Address (Icelandic: heimilisfang)
  • Telephone number (Icelandic: simanumer)

[ Top ]

Method Detail

address   [line 225]

mixed address( string $address, [int $postcode = null], [string $dataDir = ''])

Checks if given address exists If postcode is provided, check if address exists in that area.
  • Return: false on failure array on in the form of: array(array("nf" => $nf, "thgf" => $thgf, "pnr" => $postnumer)) on success.


string   $address   —  Address to validate
int   $postcode   —  Optional; check if address exists in that area
string   $dataDir   —  Optional; /path/to/data/dir

[ Top ]

phoneNumber   [line 328]

bool phoneNumber( string $number)

Validates Icelandic telephone numbers (simanumer)

Checks that the telephone number is 7digits and legal home/office/gsm number (not information/emergency service etc.)

NOTE: Number prefixed with 00354 or +354 are allowed

Note: Icelandic telephone numbers are on the form xxx-xxxx. Here we strip the "-" char from the string (if present) and/or spaces in our match.

  • Access: public


string   $number   —  the telephone number

[ Top ]

postalCode   [line 147]

bool postalCode( int $postCode, [bool $strong = false], [string $dataDir = null], [string $url = ''])

Validates Icelandic postal codes (postnumer)

Validates Icelandic postalcodes. By default checks against (prefetched) list containing all Icelandic postalcodes. Live check (against, by default, the official list) is available by switching $strong (2nd parameter) to true. $dataFile will be rewritten with the data retrived from $url in $strong mode

User can provide his own datafile if he wishes and/or own "official" list.

  • Access: public


int   $postCode   —  the postcode to be validated
bool   $strong   —  optional; check against the official list (default off)
string   $dataDir   —  optional; /path/to/data/dir
string   $url   —  optional; http://domain.tld/path/to/live/data/file.txt

[ Top ]

ssn   [line 62]

bool ssn( string $ssn)

Validate Icelandic SSN (kennitolu)

Validation according to

Note: Icelandic SSN (Social Security Number) is on the form ddmmyy-xxxx. Here we strip the "-" char from the string (if present) and/or spaces in our match. Note: PASS IN STRING, NO EXCEPTIONS! SSN with leading zero (passed as integer) will NOT get validated!

  • Access: public


string   $ssn   —  SSN

[ Top ]

Documentation generated on Mon, 11 Mar 2019 15:48:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.