note 38400 deleted from language.basic-syntax by peehaa
| From: | peehaa@php.net | Date: | Fri, 12 Jul 2013 16:16:29 +0000 |
| Subject: | note 38400 deleted from language.basic-syntax by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195587@lists.php.net to get a copy of this message | ||
Note Submitter: mwild at iee dot NO_SP_AM dot org
----
The text between <script> and </script> in XHTML is PCDATA, so < and &
characters in it should be interpreted as markup. This is a bit limiting for PHP, which is often
used to output tags, though you can of course use < and & instead. To avoid that,
which makes your code look peculiar and is easy to forget to do, you can mark the PHP as CDATA, eg :
<script language="PHP">
//<![CDATA[
echo('Today is <b>'.date('l F jS').'</b>');
//]]>
</script>
If you don't do this, and your code contains < or &, it should be rejected by an XHTML
validator.