require 'myCPF.php'; /* How to use: 1) If you have to generate new CPF code: */ $code = new myCPF(); $code->generate(); echo $code->display(); /* 2) If you have to validate entered CPF code: */ $code = new myCPF(12462195107); if($code->validate()) { echo 'valid'; } else { echo 'invalid'; }