What are the potential pitfalls of using $_SERVER['REQUEST_TIME'] to measure request duration in PHP?

Using $_SERVER['REQUEST_TIME'] to measure request duration in PHP can be inaccurate as it represents the time when the request was started, not when it was finished. To accurately measure request duration, you should use microtime(true) to record the start and end times of the request and calculate the difference.

$start_time = microtime(true);

// Your PHP code here

$end_time = microtime(true);
$request_duration = $end_time - $start_time;

echo "Request duration: " . $request_duration . " seconds";