Home >Backend Development >PHP Tutorial >Discussion and association on the use of PHP end tags_PHP tutorial
When PHP parses a file, it looks for the opening , which tell PHP to start and stop interpreting the code within it. This method of parsing allows PHP to be embedded in various documents. Any content outside a pair of opening and closing tags will be ignored by the PHP parser. In most cases PHP is embedded in HTML documents.
Single-line comments only comment to the end of the line or to the current block of PHP code, whichever comes first. This means that the HTML code after // ... ?> or # ... ?> will be displayed: ?> jumps out of PHP mode and returns to HTML mode, // or # has no effect at this point.
It can be seen from the above discussion that even if ?> appears in the // comment, the PHP parser will consider that PHP parsing is over (when PHP encounters the end mark?>, it will simply follow it The contents of are output as is (unless immediately followed by a new line, see command separator) until the next start tag is encountered).