This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 6th, 2013  |  syntax: None  |  size: 0.76 KB  |  views: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Number manipulation class
  4.  *
  5.  * This class handles any methods that are used
  6.  * to manipulate numbers
  7.  *
  8.  * @version 1.0
  9.  * @package core
  10.  * @category    class
  11.  * @author  MY NAME
  12.  * @license MIT http://opensource.org/licenses/MIT
  13.  */
  14. namespace limber\core;
  15.  
  16. class Num
  17. {
  18.     /**
  19.      * Random number generator
  20.      *
  21.      * @param   $length int The length of the number required
  22.      * @return  $num    int A random number
  23.      * @author  Unknown
  24.      */
  25.     public static function random($length = 8)
  26.     {
  27.         $characters = "0123456789abcdefghijklmnopqrstuvwxyz";
  28.         $num = "";
  29.         for ($p = 0; $p < $length; $p++) {
  30.             $num .= $characters[mt_rand(0, strlen($characters))];
  31.         }
  32.         return $num;
  33.     }
  34. }
clone this paste RAW Paste Data