当前位置:网站首页>Generate random 6-bit invitation code in PHP
Generate random 6-bit invitation code in PHP
2022-07-02 07:28:00 【Snow wind in the night sky】
Preface
In the process of system development, it is sometimes necessary to enter the invitation code when the user registers , Here is a way to quickly generate invitation codes .
/** * Generate invitation code * @param unitCode */
function create_invite_code($unitCode, $len = 3)
{
$arr = ["1", "2", "3", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
$arrLen = count($arr) - 1;
for ($i = 0; $i < $len; $i++) {
$unitCode .= $arr[mt_rand(0, $arrLen)];
}
return $unitCode;
}
for example :ANC39K
边栏推荐
- MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
- SSM二手交易网站
- Pyspark build temporary report error
- Feeling after reading "agile and tidy way: return to origin"
- MySQL组合索引加不加ID
- parser.parse_args 布尔值类型将False解析为True
- 一份Slide两张表格带你快速了解目标检测
- Drawing mechanism of view (3)
- 离线数仓和bi开发的实践和思考
- Transform the tree structure into array in PHP (flatten the tree structure and keep the sorting of upper and lower levels)
猜你喜欢
第一个快应用(quickapp)demo
Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
SSM实验室设备管理
Sparksql data skew
[introduction to information retrieval] Chapter 6 term weight and vector space model
生成模型与判别模型的区别与理解
Using MATLAB to realize: Jacobi, Gauss Seidel iteration
SSM student achievement information management system
使用 Compose 实现可见 ScrollBar
[introduction to information retrieval] Chapter 7 scoring calculation in search system
随机推荐
CSRF attack
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
Check log4j problems using stain analysis
view的绘制机制(二)
Huawei machine test questions-20190417
使用 Compose 实现可见 ScrollBar
解决万恶的open failed: ENOENT (No such file or directory)/(Operation not permitted)
Determine whether the version number is continuous in PHP
ORACLE APEX 21.2安裝及一鍵部署
view的绘制机制(三)
Conda 创建,复制,分享虚拟环境
Get the uppercase initials of Chinese Pinyin in PHP
聊天中文语料库对比(附上各资源链接)
RMAN incremental recovery example (1) - without unbacked archive logs
【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦
Yaml file of ingress controller 0.47.0
Drawing mechanism of view (I)
CRP implementation methodology
Using compose to realize visible scrollbar
【论文介绍】R-Drop: Regularized Dropout for Neural Networks