Generate Random String


/ Published in: PHP
Save to your folder(s)

Generates a random string of variable length.


Copy this code and paste it in your HTML
  1. function getUniqueCode($length = "")
  2. {
  3. $code = md5(uniqid(rand(), true));
  4. if ($length != "") return substr($code, 0, $length);
  5. else return $code;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.