PHP generates a timestamp with a specified number of digits (13 digits)

巴扎黑
Release: 2016-11-23 11:28:45
Original
3355 people have browsed it

/**

*

* Returns a timestamp with a certain number of digits. The number of digits is determined by the parameter.

*

* @author Chen Bo

* @param type How many digits the timestamp has?

* @return Timestamp

*/

private function getTimestamp($digits = false) {

$digits = $digits > 10 ? $digits : 10;

$digits = $digits - 10;

if ((!$digits) || ($digits == 10))

{

return time();

}

else

{

return number_format(microtime(true),$digits,'','');

}

}


Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template