human readable difference between two timestamps in php

I recently encountered a common problem in computer engineering:
Displaying the difference between two timestamps in a human
readable fashion. For example, between the second day of may
2012, 12 o' clock and the fourth day of may 2012, 14 o'clock are
50 hours difference, which renders into 2 days and 2 hours.

To achieve this in php, i have written the following function:

function dateDiff($date1, $date2) {
$seconds = abs($date1 - $date2);

$delay = array();
foreach( array( 86400, 3600, 60) as $increment) {
$difference = abs(floor($seconds / $increment));
$seconds %= $increment;
$delay[] = $difference;

return strtr('{days} D, {hours} H, {minutes} M', array(
'{days}' => $delay[0],
'{hours}' => $delay[1],
'{minutes}' => $delay[2]));

At first, we get the difference between the timestamp in
seconds. We remove the sign of that value with abs().
Then we splice the seconds through 86400, 3600 and 60, which
represents the seconds of one day, a hour and a minute, each.
At last we display the calculated values to the User.

A quick, handy solution in just a few lines. Enjoy !