当前位置:网站首页>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
边栏推荐
- 使用Matlab实现:幂法、反幂法(原点位移)
- Transform the tree structure into array in PHP (flatten the tree structure and keep the sorting of upper and lower levels)
- 【信息检索导论】第一章 布尔检索
- Play online games with mame32k
- CSRF attack
- RMAN incremental recovery example (1) - without unbacked archive logs
- [torch] some ideas to solve the problem that the tensor parameters have gradients and the weight is not updated
- ssm超市订单管理系统
- allennlp 中的TypeError: Object of type Tensor is not JSON serializable错误
- MySQL has no collation factor of order by
猜你喜欢

How to efficiently develop a wechat applet

sparksql数据倾斜那些事儿

Practice and thinking of offline data warehouse and Bi development

CSRF attack

【调参Tricks】WhiteningBERT: An Easy Unsupervised Sentence Embedding Approach

Illustration of etcd access in kubernetes

Play online games with mame32k

MySQL无order by的排序规则因素

Using compose to realize visible scrollbar

Agile development of software development pattern (scrum)
随机推荐
Cognitive science popularization of middle-aged people
Ding Dong, here comes the redis om object mapping framework
使用Matlab实现:弦截法、二分法、CG法,求零点、解方程
Three principles of architecture design
Sparksql data skew
Drawing mechanism of view (I)
离线数仓和bi开发的实践和思考
Tencent machine test questions
[tricks] whiteningbert: an easy unsupervised sentence embedding approach
Alpha Beta Pruning in Adversarial Search
Conda 创建,复制,分享虚拟环境
Feeling after reading "agile and tidy way: return to origin"
The first quickapp demo
DNS attack details
ORACLE APEX 21.2安裝及一鍵部署
A summary of a middle-aged programmer's study of modern Chinese history
@Transational踩坑
Yolov5 practice: teach object detection by hand
Check log4j problems using stain analysis
ORACLE EBS ADI 开发步骤