Inside comment tags...

by 8 replies
10
Quick question:

Does a php "snippet" get seen, thus processed, when inside of html comment tags?

Such as this:
Code:
<!-- 
some text, images, what-not
<? php snippet ?>
more text, etc... 
-->
Thanks, and...

Be Well!
ECS Dave
#programming #comment #inside #tags
  • No, it doesnt.
  • Yes, it most certainly does.

    The output, if any, won't be shown in the browser window because it's within the HTML comment tags, but can be seen in the page source.
  • If that php is parsed by the server, then there will be nothing there. If the php is not parsed, it will show up inside the comment but not visible in the browser.
    • [1] reply
    • It's almost best in all circumstances to use PHP comments. Why would you want to send this stuff to all users anyway.

      <?php
      /*
      some text, images, what-not
      php snippet
      more text, etc...
      */
      ?>
  • processed - yes
    get seen - depends if there is any output such as echo, print etc.
    • [1] reply
    • Thanks guys...

      The one line "snippet" was calling a function, that I didn't want called, so I simply
      deleted it, instead of leaving it in the commented html code on the page.

      Be Well!
      ECS Dave
  • Thanks everyone!

    I had thought that "hiding" something in the html comment tags would not only hide what was between them, but not process it. I see I was mistaken, and have since fixed the issue that drove me to ask...

    Be Well!
    ECS Dave
    • [1] reply
    • no it doesn't , but please use

      PHP Code:
      <?php
      // comment in one line
      /*
      multiple
      line
      */
      ?>
      in php.

      thats called scalable programming rule.

Next Topics on Trending Feed