B2.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
$days=40;
$hours=12;
$minutes=16;
$seconds=213;
$total = converttime($seconds, $minutes, $hours, $days);
function converttime($seconds, $minutes, $hours=0, $days=0){
return $days*24*60*60+$hours*60*60+$minutes*60+$seconds;
}
echo "<div>days=$days, hours=$hours, minutes=$minutes, seconds=$seconds</div>";
echo "total seconds=$total"
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse