Suppose I'm running the following JavaScript getTime() function
<script language="JavaScript">
var $x = Math.round((new Date()).getTime()/1000);
</script>
What would the equivalent code in PHP look like?
Try something like this:
echo number_format(microtime(true)*1000,0,'.','');
or because you are dividing by 1000, most probably you need this:
echo number_format(microtime(true),0,'.','');
<?php
$x = time(); // seconds
$x = microtime(); // milliseconds
?>
Check out time() and microtime().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With