Advertisement
peterurfi

[PHP] Base64 UID

Nov 14th, 2023
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. $charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
  2.    
  3. function uyid (&$charset, int $length = 11) : string {
  4.     $id = "";
  5.     for($i = 0; $i < $length; $i++) {
  6.         $id .= $charset[mt_rand(0, strlen($charset) - 1)];
  7.     }
  8.     return $id;
  9. }
  10.  
  11. print_r(uyid($charset, 11));
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement