geraDv44

The WooCommerce Boleto geraDv44 function.

Description

geraDv44( $numero ); 

Parameters (1)

0. $numero
The numero.

Usage

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

Defined (1)

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

/includes/banks/nossacaixa/functions.php  
  1. function geraDv44( $numero ) { 
  2. $resto = modulo_11( $numero, 7, 1 ); 
  3. if ( $resto == 0 ) { 
  4. $dv = 0; 
  5. elseif ( $resto > 1 ) { 
  6. $dv = 11-$resto; 
  7. elseif ( $resto == 1 ) { 
  8. $dv1 = substr( $numero, 23, 1 ); 
  9. $dv1 = $dv1 + 1; 
  10. $dv1 == 10 ? $dv1=0: $dv1; 
  11. $numero = substr( $numero, 0, 23 ).$dv1; 
  12. $dv44 = geraDv44( $numero ); 
  13. $dv=$dv1.$dv44; 
  14.  
  15. return $dv;