Copy
// 마이크로 타임을 얻어 계산 형식으로 만듦
function get_microtime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
php 5.2.17 이상에서 동작하면 됩니다.
불필요한 로직을 최적화하고 저 한 줄 주석 대신 phpdoc으로 어떻게 깔끔하게 정리할 수 있을까요?
답변 2개 / 댓글 1개
채택된 답변
+20 포인트
2023-06-26 (월) 11:37:16
Copy
return microtime(true);
2023-06-26 (월) 09:37:02
Copy
/**
* Get the current Unix timestamp with microseconds.
*
* @return float The current Unix timestamp with microseconds.
*/
function get_microtime(): float
{
list($usec, $sec) = explode(" ", microtime());
return (float)$usec + (float)$sec;
}
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.