dane-m
2/27/2014 - 5:56 PM

is_last_week() function for determining if the current date is in the last seven days of the current month.

is_last_week() function for determining if the current date is in the last seven days of the current month.

<?php
$last_week = false;
function is_last_week() {
    $days_left = date('t') - date('j');
    if ( 7 > $days_left ) :
        $last_week = true;
    endif;
    return $last_week;
}
<?php
include ('is_last_week.php');
if ( is_last_week() ) :
  echo 'We are in the last week of the month';
else :
  echo 'We havent reached the last week yet this month.';
endif;