mirror of
https://github.com/elyby/accounts.git
synced 2025-02-05 08:29:53 +05:30
19 lines
371 B
PHP
19 lines
371 B
PHP
<?php
|
|
namespace common\components;
|
|
|
|
|
|
class UserFriendlyRandomKey {
|
|
|
|
public static function make ($length = 18) {
|
|
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
$numChars = strlen($chars);
|
|
$key = '';
|
|
for ($i = 0; $i < $length; $i++) {
|
|
$key .= $chars[random_int(0, $numChars - 1)];
|
|
}
|
|
|
|
return $key;
|
|
}
|
|
|
|
}
|