title: Php file definition with variables
body: <p>I am modifying FedEx's API files to fit my site, and I am struggling to make the definitions dynamic based on the total number of packages.</p>
  
  <pre><code>$totalPackages = 4;
  for($i=1; $i&lt;=($totalPackages-1); $i++) {
      define('SHIP_CHILDLABEL_'.$i, 'shipchildlabel_'.$i.'pdf');
  }
  </code></pre>
  
  <p>Later on in the file...</p>
  
  <pre><code>for($i=1; $i&lt;=($totalPackages-1); $i++) {
      $fp = fopen(SHIP_CHILDLABEL_.$i, 'wb');
      fwrite($fp, ($childResponse-&gt;CompletedShipmentDetail-&gt;CompletedPackageDetails-&gt;Label-&gt;Parts-&gt;Image));
      fclose($fp);
      echo '&lt;a href="./'.SHIP_CHILDLABEL_.$i.'.pdf"&gt;'.SHIP_CHILDLABEL_.$i.'&lt;/a&gt; was generated';
  }
  </code></pre>
  
  <p>Of course, this causes fopen to reference SHIP_CHILDLABEL_1.pdf, SHIP_CHILDLABEL_2.pdf, and SHIP_CHILDLABEL_3.pdf instead of shipchildlabel_1.pdf, shipchildlabel_2.pdf, and shipchildlabel_3.pdf.  How can I properly make these definitions dynamic?</p>