Home >Backend Development >PHP Tutorial >PHP浮点数时间戳转正常int型

PHP浮点数时间戳转正常int型

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-20 13:05:031352browse

PHP浮点数时间戳转正常int型

做七牛云存储的时候,获取了一个文件列表,然后里面的文件上传时间返回值居然是double型的,如:1.3800892861427E+16

这怎么办?开始我用intval 转了 发现是64位的整形,不好弄,后来询问了

先截取后处理才能正确返回时间戳:

$a = '1.3800892861427E+16';
$a = strval($a);
$a = substr($a,0,11);
$a = bcmul($a,'1000000000');
//$a显示为了 1380089286 后面用date就好了


Statement:
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