I am trying to add an echo statement after the line:
echo '<td class="today" valign="top"><a class="monthnav" href="dayPlanner.php?d='.$day.'">'.$day.'</a></td>';
It is just a simple echo '';  (Really I am trying to break the line up to not include the  in the same echo statement, so I can insert some more code later.  I however am getting a Parse error after adding echo ''; and I cannot figure out why.  Any advice will be appreciated.
<?PHP
require 'includes/user_db_connect.php';
include 'includes/functions.php';
function isAjax() {
 return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
     $_SERVER ['HTTP_X_REQUESTED_WITH']  == 'XMLHttpRequest';
}
if(isAjax() && isset($_POST['month']))
{
    $month = $_POST['month'];
    $year = !isset($_POST['year']) ? date('Y', $current_time) : $_POST['year'];
    die(getCalendar($month,$year));
}
$month = date('m', time());
$year = date('Y', time());
$calendar = getCalendar($month,$year);
function getCalendar($month,$year)
{
    $current_time = time();
    $month_start = mktime(0,0,0,$month, 1, $year); 
    $month_name = date('F', $month_start); 
    $first_day = date('D', $month_start);
    switch($first_day)
    {
    case "Sun":
     $offset = 0;
     break;
    case "Mon":
     $offset = 1;
     break;
    case "Tue":
     $offset = 2;
     break;
    case "Wed":
     $offset = 3;
     break;
    case "Thu":
     $offset = 4;
     break;
    case "Fri":
     $offset = 5;
     break;
    case "Sat":
     $offset = 6;
     break;
    } 
    if($month == 1)
     $num_days_last = cal_days_in_month(CAL_GREGORIAN, 12, ($year -1));
    else
     $num_days_last = cal_days_in_month(CAL_GREGORIAN, ($month - 1), $year);
    $num_days_current = cal_days_in_month(CAL_GREGORIAN, $month, $year); 
    for($i = 0; $i < $num_days_current; $i++)
    {
     $num_days_array[] = $i+1;
    } 
    for($i = 0; $i < $num_days_last; $i++)
    {
     $num_days_last_array[] = '';
    }
    if($offset > 0){ 
     $offset_correction = array_slice($num_days_last_array, -$offset, $offset);
     $new_count = array_merge($offset_correction, $num_days_array);
     $offset_count = count($offset_correction);
    }
    else
    { 
     $new_count = $num_days_array;
    }
    $current_num = count($new_count); 
    if($current_num > 35)
    {
     $num_weeks = 6;
     $outset = (42 - $current_num);
    }
    else if($current_num < 35)
    {
     $num_weeks = 5;
     $outset = (35 - $current_num);
    }
    if($current_num == 35)
    {
     $num_weeks = 5;
     $outset = 0;
    }
    for($i = 1; $i <= $outset; $i++)
    {
     $new_count[] = '';
    }
    $weeks = array_chunk($new_count, 7);
    ob_start();
    $last_month = $month == 1 ? 12 : $month - 1;
    $next_month = $month == 12 ? 1 : $month + 1;
    echo <<<HEAD
    <table id="calendar">
    <tr>
     <td class="month">
     <p><a href="#" class="monthnav" onclick="getPrevMonth();return false;">« Prev</a>
     $month_name $year</b>
     <a href="#" class="monthnav" onclick="getNextMonth();return false;">Next »</a></p></td>
    </tr>
    <tr class="daynames"> 
     <td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td>
    </tr>
HEAD;
    foreach($weeks AS $week){
     echo '<tr class="week">'; 
     foreach($week as $day)
     {
      if($day == date('d', $current_time) && $month == date('m', $current_time) && $year == date('Y', $current_time))
       echo '<td class="today" valign="top"><a class="monthnav" href="dayPlanner.php?d='.$day.'">'.$day.'</a></td>';
      else
       echo '<td class="days" valign="top"><a class="monthnav" href="dayPlanner.php?d='.$day.'">'.$day.'</a></td>';
     }
     echo '</tr>';
    }
    echo '</table>';
    return ob_get_clean();
}
?>
<html>
<head>
<link href="./calendar.css" rel="stylesheet" type="text/css">
<script src="../js/prototype.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
    var current_month = <?PHP echo @$month ?>;
    var current_year = <?PHP echo @$year ?>;
    function getPrevMonth()
    {
     if(current_month == 1)
     {
      current_month = 12;
      current_year = current_year - 1;
     }
     else
     {
      current_month = current_month - 1;
     }
     params = 'month='+current_month+'&year='+current_year;
     new Ajax.Updater('calendar_wrapper',window.location.pathname,{method:'post',parameters: params});
    }
     function getNextMonth()
     {
      if(current_month == 12)
      {
       current_month = 1;
       current_year = current_year + 1;
      }
      else
      {
       current_month = current_month + 1;
      }
      params = 'month='+current_month+'&year='+current_year;
      new Ajax.Updater('calendar_wrapper',window.location.pathname,{method:'post',parameters: params});
     }
</script>
</head>
<body>
<div id="calendar_wrapper"><?PHP echo @$calendar ?></div>
</body>
</html>