'd', 'hours' => 'h', 'minutes' => 'm', 'seconds' => 's'] as $name => $unit) { if (!$$name) { continue; } $parts[] = sprintf('%02d%s', $$name, $unit); } return implode(' ', $parts); } }