×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: elad os
Added: May 29, 2015 10:53 PM
Views: 16
Tags: string php
make a random string.
  1.      function randstr($l=8){
  2.      $sign = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM';
  3.      $str = '';
  4.      
  5.      for ($s=0; $s<$l; $s++){
  6.              
  7.         $str .= $sign[rand(0,strlen($sign)-1)];
  8.      }
  9.       return $str;
  10.      
  11.    }