PHP using $var = <<< EOM
<p>Updating:</p>

<p>The php is considering the code beyond the EOM; closing tag.</p>

<p>Here is how my script is structured:</p>

<pre><code>&lt;?php
switch($x){

case "a":
$var = &lt;&lt;&lt; EOM;
...the html...
EOM;
break;

case "b":
...some code...
break;

}
?&gt;
</code></pre>

<p>And the script is giving erro just after the EOM;</p>

<p>Old:</p>

<p>I'm using the following code.</p>

<pre><code>$var = &lt;&lt;&lt; EOM

... some html ...

&lt;?php 
if (date("j",strtotime($row["dinicio"]))==$i){echo "selected='selected'";}
?&gt;

EOM;&gt;
</code></pre>

<p>but it fails with the following error</p>

<p>Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Apache\htdocs\ancp\adm\adm_functions.php on line 132</p>

<p>removing the $row['dinicio'] solves the problem. but i need this field</p>

<p>Any ideas?</p>

<p>Edit:</p>

<p>For more reference here a more 'complete' segment:</p>

<pre><code>&lt;select id="ddia" name="ddia" class="form-normal"&gt;
      &lt;option value="-1"&gt;dia&lt;/option&gt;
      &lt;?php
       for ($i=1; $i&lt;32; $i++){
        echo "&lt;option value='";
        echo ($i&lt;10)?"0":"";
        echo "$i' ";
        if (date("j",strtotime($row["dinicio"]))==$i){echo "selected='selected'";}
        echo "&gt;$i&lt;/option&gt;\n";
       }
      ?&gt;
     &lt;/select&gt;
</code></pre>
