html5 - php html mixed code, why does it still work with comment symbols?

WBOY
Release: 2016-08-04 09:20:21
Original
1215 people have browsed it

<code>$pfName='market_global';
?>

<!-- <?php if(($pfName == 'market_global')) { ?> -->
<th style="width: 80px">GG</th>
<!-- <?php } else { ?> -->
<th style="width: 80px">IOS</th>
<!-- <?php } ?> -->
</code>
Copy after login
Copy after login

Even if there are comment symbols at work, it still works. Why, even if the comment symbols are removed, it still works????
why??

Reply content:

<code>$pfName='market_global';
?>

<!-- <?php if(($pfName == 'market_global')) { ?> -->
<th style="width: 80px">GG</th>
<!-- <?php } else { ?> -->
<th style="width: 80px">IOS</th>
<!-- <?php } ?> -->
</code>
Copy after login
Copy after login

Even if there are comment symbols at work, it still works. Why, even if the comment symbols are removed, it still works????
why??

That kind of comment can only work on html! If you want to comment php, add a slash inside <?php ?>. For example<?php //if(($pfName == 'market_global')) { ?>Try it out


This comment is html code, not php
php code will still be executed

The comment you wrote is an html comment, not a php comment.
The php comments are
/.../
//

I also had this kind of mistake when I first learned PHP.
<!----> is the comment symbol of HTML, which is meant for the browser.
And the PHP interpreter will only recognize // /* */ #These are PHP comment symbols.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template