[PHP-NOTES] note 130322 added to function.microtime

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
Sometimes you need to get not seconds but milliseconds since the UNIX epoch:

function millis() : int {
    [$milli, $seconds] = explode(' ', microtime()); // from string(21) "0.67932100 1748377570" 
    return intval($seconds) * 1000 // intval(0.67932100 * 1000) is 679
            + intval(doubleval($milli) * 1000); // 679 + (1748377570 * 1000) = full milliseconds (1000 ms per one s)
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 213.87.151.43)
----
Manual Page -- https://php.net/manual/en/function.microtime.php
Edit        -- https://main.php.net/note/edit/130322
Del: integrated  -- https://main.php.net/note/delete/130322/integrated
Del: useless     -- https://main.php.net/note/delete/130322/useless
Del: bad code    -- https://main.php.net/note/delete/130322/bad+code
Del: spam        -- https://main.php.net/note/delete/130322/spam
Del: non-english -- https://main.php.net/note/delete/130322/non-english
Del: in docs     -- https://main.php.net/note/delete/130322/in+docs
Del: other reasons-- https://main.php.net/note/delete/130322
Reject      -- https://main.php.net/note/reject/130322
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.