Home Backend Development PHP Tutorial PHP序列号生成函数和字符串替换函数代码_PHP

PHP序列号生成函数和字符串替换函数代码_PHP

Jun 01, 2016 pm 12:11 PM
String replacement serial number

复制代码 代码如下:
/**
* 序列号生成器
*/
function snMaker($pre = '') {
$date = date('Ymd');
$rand = rand(1000000,9999999);
$time = mb_substr(time(), 5, 5, 'utf-8');
$serialNumber = $pre.$date.$time.$rand;
// echo strlen($serialNumber).'
';
return $serialNumber;
}
echo snMaker();
/**
* 将一个字符串的一部分替换成某一特定字符
* @param str or int $str 需要处理的字符串
* @param str or int $to 将替换成什么字符串
* @param int $start 保留前几个字符
* @param int $end 保留后几个字符
*/
function hideString($str = 'hello', $to = '*', $start = 1, $end = 0) {
$lenth = strlen($str) - $start - $end;
$lenth = ($lenth $to = str_repeat($to, $lenth);
$str = substr_replace($str, $to, $start, $lenth);
return $str;
}
echo hideString();
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does the Apple serial number starting with d mean? What does the Apple serial number starting with d mean? Dec 27, 2022 pm 03:38 PM

The Apple serial number beginning with d indicates that the phone was produced by Chengdu Foxconn. The serial number of an Apple mobile phone has its own meaning. The first digit represents the production place, the second and third digits represent the production line, the fourth and fifth digits represent the production year and cycle, and the sixth, seventh and eighth digits are the unique identification of the product. symbol, the ninth and tenth digits represent the model, the eleventh and twelfth digits represent the color and capacity. The first one in the serial number represents the production place: 1. F represents Zhengzhou, Henan; 2. D represents Chengdu, Sichuan; 3. C represents Shenzhen, Guangdong; 4. G0 represents Shanghai Pegatron; 5. G6 represents Shenzhen Foxconn’s new production line.

Where is the serial number starting with h on the Apple phone produced? Where is the serial number starting with h on the Apple phone produced? Mar 08, 2024 pm 01:40 PM

The serial number of an Apple phone starting with h should be an Apple phone produced in Vietnam. The beginning of the serial number of an Apple phone represents different production areas and you can also tell what version it is, which is one of the very important information. Where is the serial number of the Apple mobile phone starting with h from? Answer: The h value is produced in Vietnam. 1. Apple has moved part of its production lines to Vietnam in recent years. 2. If a user purchases an Apple mobile phone and finds that the relevant serial number begins with h, it is produced in Vietnam. 3. Different letters starting with letters indicate different production areas. Among them, those starting with F are produced by Zhengzhou Foxconn. 4. Those starting with C are produced by Shenzhen Foxconn, those starting with D are produced by Chengdu Foxconn, and those starting with G are produced by Shanghai Pegatron. 5. It is recommended not to disclose the program of your device easily.

How many digits is the hard drive serial number? How to query the Win11 hard drive serial number How many digits is the hard drive serial number? How to query the Win11 hard drive serial number Feb 29, 2024 pm 09:04 PM

The hard disk serial number can be checked through the hard disk packaging box or the hard disk casing, or in the Win11 system. However, some users do not know the method. This article is a method for querying the Win11 hard disk serial number brought to you by this site. What is the number of digits in a hard drive serial number? A computer hard drive serial number is a unique identifier that identifies a specific hard drive. It is provided by the hard drive manufacturer and cannot be modified by the user. The hard disk serial number usually contains 10 to 20 digits and letters, and of course generally consists of 12 digits. It can be used to record hard disk parameters such as hard disk capacity, loading mode, and read and write speeds. In computer systems, hard drive serial numbers are usually used to identify and distinguish different hard drives, and in some cases are used for password protection, software authorization, etc. pass

Interpret the meaning of the first letters of the iPhone serial number Interpret the meaning of the first letters of the iPhone serial number Feb 19, 2024 pm 11:06 PM

The iPhone serial number is a series of numbers and letters that uniquely identifies each iPhone device. The serial number contains a lot of information, and the letters at the beginning represent different meanings. Let’s analyze them one by one below. The first letter represents the manufacturer information of the iPhone device: A represents iPhone manufactured by Foxconn (Hon Hai Precision Industry Co., Ltd.), which is one of the most common manufacturers of iPhone; C represents Pegatron (Pegatron Precision Industry Co., Ltd. )made

How to quickly insert and fill in a serial number column in a Microsoft Word table How to quickly insert and fill in a serial number column in a Microsoft Word table Apr 17, 2023 pm 03:31 PM

When it comes to Excel and serial numbers, you may be able to handle them even while you sleep. You just need to enter 1 and drag the column down to automatically fill in the serial numbers in all cells below it. But what about Word and serial numbers? Well, most of us would frown at this advice because it's definitely not straightforward when it comes to Word. But is this impossible? Well, when did we ever say the word impossible? This article is all about autofilling serial numbers in Word documents. So let’s jump right into the article, shall we? Insert and Populate Serial Number Column in Microsoft Word Step 1: First, if your table doesn’t already have a serial number column, let’s insert one. Click on the left side of the table

What are the risks if the mobile phone serial number is leaked? What are the risks if the mobile phone serial number is leaked? Dec 04, 2023 pm 05:51 PM

Risks of leaking the mobile phone serial number: 1. Warranty issues; 2. The phone is locked; 3. Information leakage; 4. Malware attacks, etc. Detailed introduction: 1. Warranty issues. If the mobile phone serial number is leaked to unauthorized third parties, these third parties may use this information to impersonate mobile phone users and defraud the mobile phone’s warranty service; 2. The mobile phone is locked. In some cases, Under the circumstances, leaking the mobile phone serial number may cause the phone to be maliciously locked. For example, some hackers may use this information to lock the user's phone to obtain ransom or expose the user's information, etc.

How to find the serial number on your Apple Watch How to find the serial number on your Apple Watch Apr 15, 2023 pm 11:40 PM

How to Find Your Apple Watch Serial Number In Settings Open the Settings app on your Apple Watch Now tap on General → About Slide down to find your serial number If your Apple Watch is not turning on, you can also head to the Watch app on your iPhone and tap on General → Find the serial number under About (as long as the watch is still paired with your iPhone). Find your printed Apple Watch serial number. For the original Apple Watch, the serial number is printed on the back of the watch. For Apple Watch Series 1 and newer, it's inside the band slot, as shown below. Other options you'll find below

How to Find Your Computer Model on a Windows 11 PC in 10 Easy Ways How to Find Your Computer Model on a Windows 11 PC in 10 Easy Ways Apr 14, 2023 pm 06:01 PM

Microsoft's latest operating system comes with a variety of interesting features. Windows 11's UI is also very different from Windows 10's UI, so finding your PC's specs may take a little more time. Knowing your computer's model is helpful, especially if you need to upgrade system components. This article will help you simplify your search for computer models. What is a computer model? A computer's model number is a unique number assigned to each product made by the manufacturer. It usually identifies a specific line of computers, and other identical computers belonging to the same line will have slightly different model names and numbers. These numbers basically consist of letters, numbers, and sometimes the name of the series. By tracking hardware to identify parts, models when needed

See all articles