Assuming ISO 8601 formats for dates and times:
$examStartTime = new DateTime($dateExam . ' ' . $startTime);
$examEndTime = new DateTime($dateExam . ' ' . $endTime);
$now = new DateTime();
if ($now > $examStartTime && $now < $examEndTime) {
// it's exam time!
}
DateTime()
objects are comparable, so once you populate them with their appropriate dates and times, checking to see if one is between two others becomes and easy (to write and read).
The problem you had with your code was due to your comparison of the dates. PHP doesn't support expression1 logicalOperator expression2 logicalOperator expression3
(concatenating logical operations) like some languages do. I also think you need a space between the date and time elements.
$startDate = strtotime($dateExam.' '.$startTime);
$endDate = strtotime($dateExam.' '.$endTime);
if($startDate >= time() && time() <= $endDate) {
The above should work, though.