ParaChase Posted July 10, 2012 Share Posted July 10, 2012 Hello everybody, I realize that there have been several threads on this already, but I am still wondering about receiving undefined constants/indexes. In the other examples that I have seen, it involved adding quotation marks. However, I don't think that my code has that problem: <?php echo("<pre>"); $d = null; $offset = -4; echo("MARCH <br/>"); echo(" S M T W H F S <br/>"); for ($row=0; $row<=4; $row++) { for ($col=0; $col<7; $col++) { $d = $col + $row*7 + 1 + $offset; if ($d<10) { echo(" "); } echo(" "); if ($d<32 && $d>0) { echo(d); } if ($d<1) echo(" "); } echo("<br/>"); } echo("</pre>"); ?> This is code that I'm using to make a calendar. I'm not asking for code. I just want some help on why this undefined constant happens and what I can do to get rid of it. Thank you so much. Quote Link to comment https://forums.phpfreaks.com/topic/265480-undefined-constantindex/ Share on other sites More sharing options...
xyph Posted July 10, 2012 Share Posted July 10, 2012 echo(d); Quote Link to comment https://forums.phpfreaks.com/topic/265480-undefined-constantindex/#findComment-1360571 Share on other sites More sharing options...
ParaChase Posted July 10, 2012 Author Share Posted July 10, 2012 ooh I see. It's supposed to be: echo($d); Quote Link to comment https://forums.phpfreaks.com/topic/265480-undefined-constantindex/#findComment-1360572 Share on other sites More sharing options...
xyph Posted July 10, 2012 Share Posted July 10, 2012 Yup, the error message should've given you a line number. Using that, you could have easily figured this out on your own Quote Link to comment https://forums.phpfreaks.com/topic/265480-undefined-constantindex/#findComment-1360574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.