What are the potential pitfalls of using microtime() to retrieve timestamps in milliseconds in PHP?

Using microtime() to retrieve timestamps in milliseconds in PHP can lead to inaccuracies due to floating-point precision limitations and potential issues with system clock adjustments. To address this, it is recommended to use the PHP function hrtime(true) which provides a high-resolution time in nanoseconds, offering more precision and reliability.

// Using hrtime(true) to retrieve timestamps in nanoseconds
$timestamp = hrtime(true) / 1000000; // Convert nanoseconds to milliseconds
echo $timestamp;