PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of André Cupini   CPF/CNPJ Validation   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of as to use the validation functions
Class: CPF/CNPJ Validation
Validation of Brazilian CPF/CNPJ numbers
Author: By
Last change:
Date: 21 years ago
Size: 572 bytes
 

Contents

Class file image Download
<style>
BODY { font-family : verdana; font-size : 12px;}
</style>
<?
require_once("class_VALIDATE.php");
$validate = new VALIDATE;

// Replace these vars by real numbers to perform the tests
$cpf = "111.111.111-11";
$cnpj = "11.111.111/1111-11";

// It perform the tests with cpf
if($validate->cpf($cpf)) print "<b>$cpf</b> -- CPF OK!<br><br>";
else print
"<b>$cpf</b> -- Invalid CPF!<br><br>";

// It perform the tests with cnpj
if($validate->cnpj($cnpj)) print "<b>$cnpj</b> -- CNPJ OK!<br><br>";
else print
"<b>$cnpj</b> -- Invalid CNPJ!<br><br>";
?>