dvBarra

The WooCommerce Boleto dvBarra function.

Description

dvBarra( &$numero ); 

Parameters (1)

0. $numero
The numero.

Usage

  1. if ( !function_exists( 'dvBarra' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-boleto/includes/banks/real/functions.php'; 
  3.  
  4. // The numero. 
  5. $numero = &$numero; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = dvBarra($numero); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/banks/real/functions.php  
  1. function dvBarra( &$numero ) { 
  2. $pesos = "43290876543298765432987654329876543298765432"; 
  3. if ( strlen( $numero ) == 44 ) { 
  4. $soma = 0; 
  5. for ( $i = 0; $i < strlen( $numero ); $i++ ) { 
  6. $soma += $numero[$i] * $pesos[$i]; 
  7. $num_temp = 11 - ( $soma % 11 ); 
  8. if ( $num_temp >= 10 ) { 
  9. $num_temp = 1; 
  10. $numero[4] = $num_temp;