Re: Comment modes behavior in HTML and PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux