Are timestamps accurate enough for measuring page load time in PHP?

Timestamps may not be accurate enough for measuring page load time in PHP as they rely on the server's system clock, which can be affected by various factors such as network latency or server load. To accurately measure page load time, it is recommended to use PHP's built-in microtime() function, which returns the current Unix timestamp with microseconds.

$start_time = microtime(true);

// Code to measure page load time

$end_time = microtime(true);
$total_time = $end_time - $start_time;
echo "Page load time: " . $total_time . " seconds";