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

Class: Validate_FI

Source Location: /Validate_FI-0.4.0/Validate/FI.php

Class Overview


Validation class for Finland


Author(s):

Version:

  • Release: 0.4.0

Copyright:

  • 2006-2007 Jani Mikkonen

Methods


Inherited Variables

Inherited Methods


Class Details

[line 56]
Validation class for Finland

This class provides methods to validate:

  • Postal Code
  • Telephone Number
  • Car License Plate Number
  • Motorbike License Plate Number
  • Personal Identity Number (HETU)
  • Unique Identification Number (SATU)
  • Business ID Number (Y-tunnus)
  • Party Identification Number (OVT-tunnus)
  • Value Added Tax Number (ALV-numero)
  • Bank Account Number (tilinumero)
  • Bank Reference Number (viitenumero)
  • Credit Card Number



[ Top ]


Method Detail

bankAccount   [line 507]

bool bankAccount( string $number)

Validate Finnish bank account number.

This method checks the bank account number according to Finnish Bank Association.

Format: XXXXXX-XXXXXXXX, 6 digits, - and 2-8 digits.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $bankAccount '159030-776';
  6.  if Validate_FI::bankAccount($bankAccount) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  Finnish bank account number to be validated

[ Top ]

bikeLicensePlate   [line 206]

bool bikeLicensePlate( string $number)

Validate Finnish motorbike license plate number.

Format: AAAXXX. First or only number cannot be zero.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $bikeLicensePlate 'ABC123';
  6.  if Validate_FI::bikeLicensePlate($bikeLicensePlate) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  the license plate number to be validated

[ Top ]

businessId   [line 360]

bool businessId( string $number)

Validate Finnish Business ID (Y-tunnus).

The Finnish Business ID number (Y-tunnus) is a 9 digit number. The last digit is a control number (y).

Format: xxxxxxx-y

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $businessId '1572860-0';
  6.  if Validate_FI::businessId($businessId) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  Business ID number to be validated

[ Top ]

carLicensePlate   [line 159]

bool carLicensePlate( string $number)

Validate Finnish car license plate number.

Format: AAA-XXX, CD-XXXX or C-XXXXX. First or only number cannot be zero.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $carLicensePlate 'ABC-123';
  6.  if Validate_FI::carLicensePlate($carLicensePlate) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  the license plate number to be validated

[ Top ]

creditCard   [line 627]

bool creditCard( string $number)

Validate credit card number.

This method checks the credit card number according to Luhn algorithm. This method doesn't guarantee that the card is legitimate.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $creditCard '5427 0073 1297 6425';
  6.  if Validate_FI::creditCard($creditCard) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>

  • Return: true if credit card number is valid, false otherwise
  • Access: public

Parameters:

string   $number   —  credit card number to be validated (spaces and dashes tolerated)

[ Top ]

finuid   [line 314]

bool finuid( string $number)

Validate Finnish Unique Identification Number (SATU).

FINUID (SATU) is a 9 digit number. The last digit is a control number.

Example: 10011187H

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $finuid '10011187H';
  6.  if Validate_FI::finuid($finuid) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  FINUID number to be validated

[ Top ]

partyId   [line 417]

bool partyId( int $number)

Validate Finnish Party Identification number (OVT-tunnus).

The Finnish Party Identification number (OVT-tunnus) is a 12-17 digit number and it is generated from Business ID.

Example: 0037AAAAAAAABBBBB, 0037 indicates Finland, AAAAAAAA is the Business ID and BBBBB is optional organization number.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $partyId '003715728600';
  6.  if Validate_FI::partyId($partyId) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

int   $number   —  Party Identification number to be validated

[ Top ]

phoneNumber   [line 122]

bool phoneNumber( string $number)

Validate Finnish telephone number.

Simple check: number must be numeric when (, ), -, +, ., ' ' chars are removed and 3-20 digit number.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $phoneNumber '+358 40 1234567';
  6.  if Validate_FI::phoneNumber($phoneNumber) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>

  • Return: true if telephone number is valid, false otherwise
  • Access: public

Parameters:

string   $number   —  the telephone number to be validated

[ Top ]

pin   [line 257]

mixed pin( string $number, [bool $info = false])

Validate Personal Identity Number (HETU).

The Finnish PIN number (HETU) aka Social Security Number (SSN) is a 11 digit number with birthdate as ddmmyycxxxy where c is century, xxx is a three digit individual number and the last digit is a control number (y).

If xxx is odd it's a male PIN number and if even a female.

Return gender (Male or Female) and date of birth (YYYY-MM-DD) in array if PIN is valid, is available by switching $info (2nd parameter) to true.

Example: 010101-123N would be a male and born in 1st of January 1901.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $pin '010101-123N';
  6.  if Validate_FI::pin($pin) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  if $userinfo Validate_FI::pin($pintrue) ) {
  13.      print_r($userinfo);
  14.  else {
  15.      print 'Not valid!';
  16.  }
  17.  
  18.  ?>


Parameters:

string   $number   —  PIN number to be validated
bool   $info   —  optional; Return gender and date of birth on success

[ Top ]

postalCode   [line 89]

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

Validate Finnish postal code.

Five digit postal code, maybe with a leading 'FI-'.

Format: XXXXX or FI-XXXXX

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $postalCode '00100';
  6.  if Validate_FI::postalCode($postalCode) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>

  • Return: true if postal code is valid, false otherwise
  • Access: public

Parameters:

string   $number   —  the postal code to be validated
bool   $strong   —  optional; strong checks (e.g. against a list of postal codes)

[ Top ]

refNum   [line 563]

bool refNum( string $number)

Validate Finnish bank reference number.

This method checks the bank reference number according to Finnish Bank Association.

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $refNum '61 74354';
  6.  if Validate_FI::refNum($refNum) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  Finnish bank reference number to be validated

[ Top ]

vatNumber   [line 463]

bool vatNumber( string $number)

Validate Finnish Value Added Tax number (ALV-numero).

The Finnish VAT number (ALV-numero) is maximum of 14 digits and is generated from Business ID.

Format: FIXXXXXXXX

  1.  <?php
  2.  // Include the package
  3.  require_once 'Validate/FI.php';
  4.  
  5.  $vatNumber 'FI15728600';
  6.  if Validate_FI::vatNumber($vatNumber) ) {
  7.      print 'Valid';
  8.  else {
  9.      print 'Not valid!';
  10.  }
  11.  
  12.  ?>


Parameters:

string   $number   —  VAT number to be validated

[ Top ]


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