Re: Comment modes behavior in HTML and PHP
| From: | Richard Lynch | Date: | Sun, 29 Jul 2007 05:31:34 +0000 |
| Subject: | Re: Comment modes behavior in HTML and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259757@lists.php.net to get a copy of this message | ||
On Sat, July 28, 2007 9:40 am, C.R.Vegelin wrote:
> I have a PHP script, as follows:
> <!--
> <?php
> echo "should this be echoed ?";
> ?>
> -->
>
> As expected, the browser shows nothing,
> but when I view Source in the browser, I see:
> <!-- start HTML comment
> should this be echoed ?-->
>
> Shouldn't it be just: <!-- -->, without the echo result ?
> I don't expect PHP to be active between <!-- -->.
I can see what you mean, but that's just not how it works, and for a
very good reason:
<script language="JavaScript" type="text/js">
<!-- hide from old browsers
<?php echo "var foo = '$foo';\n";?>
-->
</script>
Actually, there are many other good reasons as well, but that's
probably the most easily understood for a beginner. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?