Created
August 20, 2015 19:30
-
-
Save alash3al/c71983b4b324f84795b2 to your computer and use it in GitHub Desktop.
milliseconds - return current Unix timestamp with milliseconds for php just like javascript's Date.now()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Return current Unix timestamp with milliseconds | |
* | |
* @author Mohammed Al Ashaal <github/alash3al, fb/alash3al, tw/m7medalash3al> | |
* @return float "due to INT limitaions" | |
*/ | |
public function milliseconds() | |
{ | |
list($a, $b) = explode(' ', microtime()); | |
return floatval(intval($b) . "" . intval($a * 1000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment