note 38400 added to language.basic-syntax

From: Date: Fri, 19 Dec 2003 10:12:05 +0000
Subject: note 38400 added to language.basic-syntax
Groups: php.notes 
Request: Send a blank email to php-notes+get-62222@lists.php.net to get a copy of this message
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 &lt; and &amp; 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. ---- Manual Page -- http://www.php.net/manual/en/language.basic-syntax.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38400 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38400&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38400&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#62222) next »