Copy codeThe Code is as follows :/**
* Serial number generator
*/
Function snMaker ($ pre = ''){
$ Date = date ('ymmd ');
$ Rand = rand );
$ Time = mb_substr (time (), 5, 5, 'utf-8 ');
$ SerialNumber = $ pre. $ date. $ time. $ rand;
// Echo strlen ($ serialNumber). '<br/> ';
Return $ serialNumber;
}
Echo snMaker ();
/**
* Replace a part of a string with a specific character.
* @ Param str or int $ str string to be processed
* @ Param str or int $ to replace the string
* @ Param int $ start keep the first few characters
* @ Param int $ end keep the last few characters
*/
Function hideString ($ str = 'hello', $ to = '*', $ start = 1, $ end = 0 ){
$ Lenth = strlen ($ str)-$ start-$ end;
$ Lenth = ($ lenth <0 )? 0: $ lenth;
$ To = str_repeat ($ to, $ lenth );
$ Str = substr_replace ($ str, $ to, $ start, $ lenth );
Return $ str;
}
Echo hideString ();