ninja_forms_random_string

The Ninja Forms ninja forms random string function.

Description

ninja_forms_random_string( (int) $length = 10 ); 

Parameters (1)

0. $length — Optional. (int) => 10
The length.

Usage

  1. if ( !function_exists( 'ninja_forms_random_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/functions.php'; 
  3.  
  4. // The length. 
  5. $length = 10; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_random_string($length); 
  9.  

Defined (1)

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

/deprecated/includes/functions.php  
  1. function ninja_forms_random_string($length = 10) { 
  2. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
  3. $random_string = ''; 
  4. for ($i = 0; $i < $length; $i++) { 
  5. $random_string .= $characters[rand(0, strlen($characters) - 1)]; 
  6. return $random_string;