title: FPDF Footer on last page using If statement and {nb}
body: <p>I have seen quite a few questions on this but not definitive answer. Im using FPDF to dynamically create PDF with values form a DB, I only want a footer on the last page, seeing as its values are based on DB values the PDF could be 2,3,4 pages long. So i started messing around with the footter of FPDF like so</p>
  
  <pre><code>function Footer()
  {
      $this-&gt;SetY(-15);
      $this-&gt;SetFont('Arial','I',8);
      //Page number
      $pagenumber = '{nb}';
      if($this-&gt;PageNo() == 2){
          $this-&gt;Cell(173,10, ' FOOTER TEST  -  '.$pagenumber, 0, 0);
      }
  }
  </code></pre>
  
  <p>This retruns the value "FOOTER TEST - 2" on the second page and if i set the if to "&lt;=2" will put the same on page one and two, GREAT! it recognises $pagenumber as 2 or if i had 3 pages as 3, so it can see that i have however many pages, however, when i change the code to:</p>
  
  <pre><code>function Footer()
  {
      $this-&gt;SetY(-15);
      $this-&gt;SetFont('Arial','I',8);
      //Page number
      $pagenumber = '{nb}';
      if($this-&gt;PageNo() == $pagenumber){
          $this-&gt;Cell(173,10, ' FOOTER TEST  -  '.$pagenumber, 0, 0);
      }
  }
  </code></pre>
  
  <p>Thinking that it output the last page once, adding that to the if statement will make it work, it doesn't display anything, like the if statement cant recognize the value for $pagenumber, is this because it is a string or int trying to compare to the opposite or something else?</p>
  
  <p>Any help greatly appropriated.</p>
  
  <p>Ian</p>