PHP function to check if something valid or return error message
Simply , the method isTodayWithinDateRange can throw the exception in this case since the responsability of the method is to check the constraint . 
So , i think that you can try it as : 

function isTodayWithinDateRange(\DateTime $start, \DateTime $end) {
  $now = new \DateTime();
  if($now &lt; $start) throw new Excception('Today is before the start date') ;
  if($now &gt; $end) throw new Exception('Today is later than the end date');  
  return true;

}


First , start with case where you are looking to throw exception , in this case , it's not clearly , but think about a case where you have a lot of logic , here you should start with cases where you don't need to manipulate your logic (like if the argument is null , or missing ...) . 

Call you  method as : 

$myStart = new Datetime('01-06-2012');
$myEnd = new Datetime('01-06-2020');

// loop 

try{

if(isTodayWithinDateRange($myStart, $myEnd)) {
 echo 'contraint validated';

}
}catch(Exception $e){

    echo $e-&gt;getMessage();
}
//end loop


I hope this help you .