title: PHP variable is not working in a heredoc when adding a 6th
body: <p>I wrote a heredoc three weeks ago that was working great, and until today it used five PHP variables.</p>
  
  <p>Here is the heredoc:</p>
  
  <pre><code>   echo &lt;&lt;&lt;itemDetails_HEREDOC
     &lt;img src="$sitePath/images/logo-landing2.png" /&gt;
     &lt;form action="$thisFilename" method="post" name="arti-form" id="arti-formId"&gt;
        &lt;label style="display: inline-block; width: 140px"&gt;OWNER NAME:&lt;/label&gt;&lt;input type="text" style="width: 300px"
             id="ownerId" name="ownerName" readonly="readonly" value="$theLoggedInUser" /&gt;&lt;br /&gt;
        &lt;label style="display: inline-block; width: 140px"&gt;THE ITEM:&lt;/label&gt;&lt;input type="text"  style="width: 300px"
            readonly="readonly" id="itemNameId" name="itemName" value="$itemName" /&gt;&lt;br /&gt;
        &lt;label style="display: inline-block; width: 140px"&gt;LINK:&lt;/label&gt;&lt;input type="text"  style="width: 300px"
            readonly="readonly" id="itemLinkId" name="link" value="$theLinkID" /&gt;&lt;br /&gt;
        &lt;label style="display: inline-block; width: 140px"&gt;ERA:&lt;/label&gt;&lt;input type="text"  style="width: 70px"
            readonly="readonly" id="itemEraId" name="itemEra" value="$itemEra" /&gt;&lt;br /&gt;
  itemDetails_HEREDOC;
  </code></pre>
  
  <p>There are six (6) PHP variables in the above heredoc. The first one ($sitePath) <em>does not work</em>. I just added it today.</p>
  
  <p>For some reason, the server is not replacing '$sitePath' (the first PHP variable in my heredoc) correctly because when the browser receives the above page, an error is generated:</p>
  
  <pre><code>  Notice: Undefined variable: sitePath in C:\xampp\htdocs\Arti-facks\showItem.php on line 221
  </code></pre>
  
  <p>Here are the five PHP variables that have been in the heredoc and working fine for three weeks -- they are being correctly replaced with their values <em>before</em> the HTML is sent to my browser:</p>
  
  <ul>
  <li>$thisFilename</li>
  <li>$theLoggedInUser</li>
  <li>$itemName</li>
  <li>$theLinkID</li>
  <li>$itemEra</li>
  </ul>
  
  <p>Just how do I know the above PHP variables are being correctly resolved on the server, with their associated values being put into the heredoc then sent to the browser?</p>
  
  <p>Simple -- I do a 'view page source' and instead of seeing '$thisFilename', or '$itemName', etc. in the HTML code sent by the server --  I instead see their associated values in the above heredoc HTML content.</p>
  
  <p>For example, the page source shows me that '<strong>$thisFilename</strong>' in the heredoc got correctly resolved to "<strong>showItem.php</strong>."</p>
  
  <p>My '$sitePath' is declared in a global include file called "<strong>globals.php</strong>" and in that file, $sitePath is declared like this:</p>
  
  <pre><code>  $sitePath = "http://localhost/Arti-facks";
  </code></pre>
  
  <p>And at the top of showItem.php I have had, for the past three weeks, this include statement to pull in <strong>globals.php</strong>:</p>
  
  <pre><code>  require_once 'globals.php'; // Variables and statics used throughout
  </code></pre>
  
  <p>So today I added the $sitePath declaration (above) inside of globals.php</p>
  
  <p>To prove that showItem.php is able to 'see' the newly-declared $sitePath I added to globals.php, I echo the variable -- sure enough, showItem.php is 100% able to 'see' my newly-declared $sitePath.</p>
  
  <p><em>And yet</em> -- despite that -- and despite three weeks of using the above heredoc with its <em>five other</em> PHP variables --
  the heredoc is <em>not</em> getting $sitePath.</p>
  
  <p>When I 'view page source' here's what I see for the $sitePath line of the heredoc above:</p>
  
  <pre><code>    &lt;img src="/images/logo-landing2.png" /&gt;
  </code></pre>
  
  <p>You can see that the $sitePath part before the /images/logo-landing2.png is <em>blank</em> or missing.</p>
  
  <p>Why have I, for three solid problem-free weeks, been getting <em>five</em> successfully-resolved PHP variables in the above heredoc, yet I add a 6th PHP variable today and it's as if</p>
  
  <blockquote>
    <p>"Goodness, your quota for PHP variables in your heredoc there was maxed out at 5. And now we see you're trying to use a 6th PHP variable -- what were you thinking."</p>
  </blockquote>