How to get timestamp value in php which is similar to getTime() in javascript
Following javascript code gives me output like : 1314066350368
new Date().getTime();
I would like to generate similar timestamp in PHP in order to get server's time开发者_如何学Gostamp. kindly suggest me how to do it in PHP so my PHP code will generate exactly similar timestamps.
P.S. I do know about time() and microtime() functions in PHP. But i am looking forward to get similar outputs as i have mentioned above.
Try this:
<?php
echo microtime(true)*1000;
?>
Did you try int time ( void ), Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
the following php results time stamp that is similar to javascript 'new Date().getTime()'
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec) * 100;
}
精彩评论