Welcome Guest, Not a member yet? Register   Sign In
Introducing RandGen, CodeIgniter library for...
#1

Hello everyone, RandGen is a small lightweight CodeIgniter library for generating random strings.

Requirements
  • PHP >=5.2.4
Dependencies
  • None
Download|Contribute|View documentation => on Github

Usage sample:
PHP Code:
<?php
 
class My_Class extends CI_Controller {
    public function 
index() {
      
// Load the library
      
$this->load->library('rand-gen');
    
      
// Random string of 100 characters using the default combination
 
     $randString $this->rand_gen->generate(100);
 
     echo $randString;

 
     // Random string of 30 characters containing only alphabets
 
     $randAlphaString $this->rand_gen->generate(30'alpha');
 
     echo $randAlphaString;

 
     // Random string of 250 characters containing only numbers
 
     $randNumString $this->rand_gen->generate(250'numeric');
 
     echo $randNumString;

 
     // Random string of 50 characters containing only alphabets and numbers
 
     $randAlphanumString $this->rand_gen->generate(50'alpha-numeric');
 
     echo $randAlphanumString
  }
}
?>
Reply
#2

(This post was last modified: 09-11-2016, 04:18 AM by Wouter60.)

CI has the random_string() function inside the string helper. What are the benefits of this library compared to that?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB