How can the DateInterval class in PHP be utilized to accurately format time intervals, especially for intervals greater than 24 hours?

When dealing with time intervals greater than 24 hours in PHP, the DateInterval class can be utilized to accurately format and display the interval in a human-readable way. By using the DateInterval class along with the DateTime class, you can easily calculate and format time differences in days, hours, minutes, and seconds.

// Create two DateTime objects for the start and end times
$start = new DateTime('2022-01-01 08:00:00');
$end = new DateTime('2022-01-03 15:30:00');

// Calculate the interval between the two DateTime objects
$interval = $start->diff($end);

// Format the interval for display
echo $interval->format('%a days, %h hours, %i minutes');