How do I comment out if I use this syntax?:
<?php
echo <<<EOF
Is it //Comment or <!-- Comment --> or something else?
EOF;
?>
I'm a little bit confused. Thank you
You can't. The point of HEREDOC is that anything inside it will be part of the string. It exists to avoid having PHP meta characters (including comments) treated as such. Anything you put inside it will appear in the string (and thus, in this instance, be echoed to wherever the output is directed).
If the output is HTML, then you could include an HTML comment in it. That will still appear in the output, but anything parsing the HTML will treat it as a comment. Likewise, if the content is JS then you can use a JS comment, and so on.
You can't use a comment inside the heredoc
syntax.
http://en.wikipedia.org/wiki/Here_document
It's a way to specify a literal string, literally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With