wc_let_to_num

Let_to_num function.

Description

(int) wc_let_to_num( $size ); 

This function transforms the php.ini notation for numbers (like 2M) to an integer.

Returns (int)

Parameters (1)

0. $size
The size.

Usage

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

Defined (1)

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

/includes/wc-formatting-functions.php  
  1. function wc_let_to_num( $size ) { 
  2. $l = substr( $size, -1 ); 
  3. $ret = substr( $size, 0, -1 ); 
  4. switch ( strtoupper( $l ) ) { 
  5. case 'P': 
  6. $ret *= 1024; 
  7. case 'T': 
  8. $ret *= 1024; 
  9. case 'G': 
  10. $ret *= 1024; 
  11. case 'M': 
  12. $ret *= 1024; 
  13. case 'K': 
  14. $ret *= 1024; 
  15. return $ret;