<?php // force Internet Explorer to use the latest rendering engine available ?>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php // mobile meta (hooray!) ?>
<meta name="HandheldFriendly" content="True">
I've seen this trend more and more lately. Does it have any advantages or disadvantages over the traditional way of leaving comments/notes?
Correct me if I'm wrong, but I think that the only reason is that you use this, is that you won't see the comments in the browser's source-view of your website.
<?php echo'<!--- force Internet Explorer to use the latest rendering engine available-->' ?>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php echo'<!--- mobile meta (hooray!)-->' ?>
<meta name="HandheldFriendly" content="True">
For my experience the only advantage with this trend is valuable when you have to comment large blocks of code/markup, like php mixed with hmtl or javascript.
That being said, best practices don't recommend mixing code and html when it's possible, but if you have to, it is better do this thing
<?php /*
//js code
<!--
<script type="text/javascript">
//my js script
</script>
-->
<!--
<p>a bit of commented html</p>
-->
*/ ?>
instead of
//js code
<!--
<script type="text/javascript">
//my js script
</script>
-->
<!--
<p>a bit of commented html</p>
-->
I would rather use this:
<?php
// force Internet Explorer to use the latest rendering engine available
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">'.PHP_EOL;
// mobile meta (hooray!)
echo '<meta name="HandheldFriendly" content="True">'.PHP_EOL;
and probably not use simple echo's like this. I simply don't like mixing PHP and HTML, it's ugly. Better go with full PHP code.
Adding comments with php has one Advantage that only the developers reading php code will see these comments and that cannot be seen by viewing source code of page(html).