title: open PDF in browser with PHP
body: <p>I am doing:</p>
  
  <pre><code>header('Content-type: application/pdf');
  header('Content-Disposition: inline; filename="the.pdf"');
  header('Content-Length: ' . filesize($file));
  @readfile($file);
  </code></pre>
  
  <p>and it works fine. The PDF opens in the browser.</p>
  
  <p>Can I do an if-then-else before? I tried and I get raw PDF </p>
  
  <pre><code>%PDF-1.2 9 0 obj &lt;&lt; /Type/Font /Subtype/Type1 /Name/F1 /FontDescriptor 8 0
  </code></pre>
  
  <p>Why is the if-then-else changing the headers?</p>
  
  <p>thanks.</p>