The problem is the if statement
This is an attribution not a comparison
if( $output = "return" ){ ...
Should be something like:
function remaining($expDate,$output){
$dStart = new DateTime(date('Y-m-d'));
$dEnd = new DateTime(date('Y-m-d ',strtotime($expDate)));
$dDiff = $dStart->diff($dEnd);
return $dDiff->days;
}
AH!! By the way the code above works, you are not managing in getting it to work because you
forgot to do this: <?php echo remaining()... ?>
you forgot the echo!
Regards.