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

Class: Validate_CH

Source Location: /Validate_CH-0.6.0/Validate/CH.php

Class Overview

Data validation class for Switzerland



  • Release: @package_version@


  • 1997-2005 Hans-Peter Oeri


Inherited Variables

Inherited Methods

Class Details

[line 46]
Data validation class for Switzerland

This class provides methods to validate:

  • Social insurance number (aka SSN)
  • Swiss university's immatriculation number
  • Postal code

[ Top ]

Method Detail

postalCode   [line 135]

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

Validate a Swiss ZIP
  • Return: true if postcode is ok, false otherwise
  • Access: public


string   $postcode   —  postcode to validate
bool   $strong   —  optional; strong checks (e.g. against a list of postcodes)

[ Top ]

ssn   [line 61]

bool ssn( string $ssn)

Validate a Swiss social security number

The Swiss social security numbers follow a very strict format. A check digit is the last one, computed the standard _get_control_number function.

  • Return: true on success
  • Access: public


string   $ssn   —  ssn to validate

[ Top ]

studentid   [line 97]

bool studentid( string $umn)

Validate a Swiss university's immatriculation number

Swiss immatriculation numbers are used by all universities in Switzerland. They are used in two primary formats: Official is a readable one with dashes, but commonly only the eight digits are just concatenated.

As for check digit, a somewhat "weird" algorithm is used, in which not a sum of products, but the sum of the digits of products are taken.

  • Return: true on success
  • Access: public


string   $umn   —  university's immatriculation number

[ Top ]

Documentation generated on Thu, 10 Dec 2015 05:51:46 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.