wc_rand_hash

Generate a rand hash.

Description

(string) wc_rand_hash(); 

Returns (string)


Usage

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

Defined (1)

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

/includes/wc-core-functions.php  
  1. function wc_rand_hash() { 
  2. if ( function_exists( 'openssl_random_pseudo_bytes' ) ) { 
  3. return bin2hex( openssl_random_pseudo_bytes( 20 ) ); 
  4. } else { 
  5. return sha1( wp_rand() );