title: Why global is null in function?
body: <p>I get this strange problem....</p>
  
  <p>All the page has this code only.
  global $currentPage; is null and i dont know why...</p>
  
  <pre><code>&lt;?php
  $pager = $_PARAMS["this"];
  $pages = 5;
  $currentPage = 1;
  $tst="ap";
  $nearPages = 5;
  //Prologic
  ?&gt;
  &lt;div class="pager"&gt;
  &lt;?php
  $nearPagesHalf = ($nearPages - 1) / 2;
  
  drawNumbers(1, 1);
  if ($currentPage - $nearPagesHalf &lt;= 0) {
  
  }
  
  drawNumbers($pages, $pages);
  ?&gt; 
  
      &lt;?php
  
      function drawNumbers($from, $to) {
          global $currentPage;
  
  
  
          for ($i = $from; $i &lt;= $to; $i++) {
  
              echo $currentPage;
  
              if ($i == $currentPage) {
      ?&gt; &lt;span class="pageNumbers current"&gt;&lt;?= $i ?&gt;&lt;/span&gt;
  
      &lt;?php
              } else {
      ?&gt;
                  &lt;a href="#"&gt;
                      &lt;span class="pageNumbers"&gt;&lt;?= $i ?&gt;&lt;/span&gt;
                  &lt;/a&gt;
  &lt;?php
              }
          }
  ?&gt;
      &lt;?php
      }
  
      function drawDots($from, $to) {
  
      }
      ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>THE PROBLEM </p>
  
  <pre><code>echo $currentPage; prints 1 
          function drawNumbers($from, $to) {
              global $currentPage;
             echo $currentPage; prints nothing
  </code></pre>