php获取小数点后的值
如果我在变量中有一个值,例如 10.2333,并且我需要使用 .2333 的 23,我该怎么做?有关更多信息,我正在计算时间差:
$started = $_SESSION['now'];
$ended = time();
$time1 = $ended - $started;
$time2 = $time1 / 60;
$time2 给我例如 10.233
If I've got a value in a variable eg 10.2333 and I need to use the 23 of the .2333 how do i do that? For more information, I am working out a time difference:
$started = $_SESSION['now'];
$ended = time();
$time1 = $ended - $started;
$time2 = $time1 / 60;
$time2 gives me for example 10.233
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这应该会给你你想要的。
编辑:问题结果有所不同。要获取 UNIX 时间戳的分钟和秒,您应该执行以下操作。
This should give you what you want.
Edit: Question turned out to be different. To get minutes and seconds of a unix timestamp, you should do the following.
像这样的事情可能会起作用:
Something like this might work: