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

Class: Validate_ptBR

Source Location: /Validate_ptBR-0.5.5/Validate/ptBR.php

Class Overview


Data validation class for Brazil


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 1997-2005 Silvano Girardi Jr.

Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]
Data validation class for Brazil

This class provides methods to validate:

  • Postal code CEP (Código de Endereçamento Postal)
  • CPF (Cadastro de Pessoa Física)
  • CNPJ (Cadastro Nacional de Pessoa Jurídica)
  • Regions - brazilian states (Estados brasileiros)
  • Phone Numbers - brazilian phone numbers
  • Vehicle Plates - brazilian vehicle's plate



[ Top ]


Method Detail

carReg   [line 294]

bool carReg( string $reg)

Validates a brazilian (ptBR) vehicle's plate

Also allows the following formats XXX-XXXX,XXX XXXX,XXXXXXX The first three chars are [A-Z] The last four chars are [0-9]

  • Access: public

Parameters:

string   $reg     vehicle's plate

[ Top ]

cnpj   [line 142]

bool cnpj( string $cnpj)

Validade CNPJ (Cadastro Nacional de Pessoa Jurídica)
  • Return: true if $cnpj is ok, false otherwise
  • Access: public

Parameters:

string   $cnpj     CNPJ to validate

[ Top ]

cpf   [line 71]

bool cpf( string $cpf)

Validade CPF (Cadastro de Pessoa Física)
  • Return: true if $cpf is ok, false otherwise
  • Access: public

Parameters:

string   $cpf     CPF to validate

[ Top ]

phoneNumber   [line 267]

bool phoneNumber( string $number, [bool $requireAreaCode = true])

Validates a brazilian (ptBR) phone number.

Also allows the formats If $requiredAreaCode is true: (XX)-XXXX-XXXX,(XX) XXXX XXXX, (XX)-XXXX XXXX, (XX) XXXX-XXXX, XX-XXXX-XXXX,XX XXXX XXXX,XX-XXXX XXXX,XX XXXX-XXXX,XX XXXXXXXX,(XX)XXXXXXXX If $requiredAreaCode is false: XXXX-XXXX,XXXX XXXX, XXXXXXXX

  • Return: The valid or invalid phone number
  • Access: public

Parameters:

string   $number     phone to validate
bool   $requireAreaCode     require the area code? (default: true)

[ Top ]

pis   [line 312]

bool pis( string $pis)

Validate PIS (Programa de Integracao Social)

Allows the following formats XXX.XXX.XXX-XX, XXXXXXXXXXX or any combination with dots and/or hyphens

  • Access: public

Parameters:

string   $pis     pis code

[ Top ]

postalCode   [line 59]

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

Validate CEP (Código de Endereçamento Postal, like postcode in US and other languages) format: xxxxx-xxx,xxxxx xxx,xxxxxxxx
  • Return: true if $cep is ok, false otherwise
  • Access: public

Parameters:

string   $postalCode     pt_BR CEP/postalCode to validate
bool   $strong     optional; strong checks (e.g. against a list of postcodes) (not implanted)

[ Top ]

region   [line 218]

bool region( string $region)

Validates a "region" (i.e. state) code
  • Return: true if $region is ok, false otherwise
  • Access: public

Parameters:

string   $region     2-letter state code

[ Top ]


Documentation generated on Wed, 26 Nov 2008 20:00:06 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.