Чтобы преобразовать микровремя PHP в миллисекунды (мс), вы можете использовать следующие методы:
Метод 1: использование функций microtime
и explode
// Get the current microtime
$microtime = microtime(true);
// Split the microtime into seconds and microseconds
list($seconds, $microseconds) = explode(' ', $microtime);
// Convert the microseconds to milliseconds
$milliseconds = round($microseconds * 1000);
// Output the result
echo $milliseconds;
Метод 2: использование функций microtime
и sprintf
// Get the current microtime
$microtime = microtime(true);
// Convert the microtime to milliseconds using sprintf
$milliseconds = sprintf("%d", $microtime * 1000);
// Output the result
echo $milliseconds;
Метод 3: использование функций microtime
и intval
// Get the current microtime
$microtime = microtime(true);
// Convert the microtime to milliseconds using intval
$milliseconds = intval($microtime * 1000);
// Output the result
echo $milliseconds;