title: One PHP Variable in Multiple PHP Tag
body: <p>I have this this PHP tag:</p>
  
  <pre><code>&lt;?php 
  $date = '2018-09-01';
  $end = '2018-09-' . date('t', strtotime($date));
  ?&gt;
  </code></pre>
  
  <p>and I want to use those two variables inside multiple PHP tag in the same page like this:</p>
  
  <p><strong>PHP TAG 1</strong></p>
  
  <pre><code>&lt;?php 
     while(strtotime($date) &lt;= strtotime($end)) {
        $day_num = date('d', strtotime($date));
        $day_name = substr(date('l', strtotime($date)), 0, 2);
        $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
        echo "&lt;th class='$day_num $day_name'&gt;$day_num &lt;br&gt; &lt;div id='day-name'&gt;$day_name&lt;/div&gt;";};
  ?&gt;
  </code></pre>
  
  <p><strong>PHP TAG 2</strong></p>
  
  <pre><code>&lt;?php          
     while(strtotime($date) &lt;= strtotime($end)) {
        $day_num = date('d', strtotime($date));
        $day_name = date('l', strtotime($date));
        $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
        echo "&lt;td class='$day_num $day_name'&gt;&lt;input type='checkbox' class='uk-checkbox'&gt;&lt;/td&gt;";
          };
  ?&gt;
  </code></pre>
  
  <p>The problem is that it works in the <strong>PHP TAG 1</strong> and not working in <strong>PHP TAG 2</strong>.</p>
  
  <p>What is the problem that it is showing any output in <strong>PHP TAG 2</strong>.</p>
  
  <p>There is no error shown in console.</p>
  
  <p>Remember that I can't join these two PHP tags because they are separated by another contents in the page.</p>