/** * Lenght: 11 * Formato: 999.999.999-99 * @param string $cpf * @return string|null */ public static function cpf($cpf) { if (VALIDAR::cpf($cpf)) { $cpf = preg_replace('/[^0-9]/', '', $cpf); return preg_replace('/^([0-9]{3})([0-9]{3})([0-9]{3})([0-9]{2})$/', '$1.$2.$3-$4', $cpf); } return null; }