cvs: phpdoc /en/language basic-syntax.xml

From: Date: Mon, 06 Jul 2009 14:41:34 +0000
Subject: cvs: phpdoc /en/language basic-syntax.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4352@lists.php.net to get a copy of this message
sammywg Mon Jul 6 14:41:34 2009 UTC Modified files: /phpdoc/en/language basic-syntax.xml Log: typo http://cvs.php.net/viewvc.cgi/phpdoc/en/language/basic-syntax.xml?r1=1.53&r2=1.54&diff_format=u Index: phpdoc/en/language/basic-syntax.xml diff -u phpdoc/en/language/basic-syntax.xml:1.53 phpdoc/en/language/basic-syntax.xml:1.54 --- phpdoc/en/language/basic-syntax.xml:1.53 Tue Jun 23 04:04:50 2009 +++ phpdoc/en/language/basic-syntax.xml Mon Jul 6 14:41:34 2009 @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.53 $ --> +<!-- $Revision: 1.54 $ --> <chapter xml:id="language.basic-syntax" xmlns="http://docbook.org/ns/docbook"> <title>Basic syntax</title> <sect1 xml:id="language.basic-syntax.phpmode"> <title>Escaping from HTML</title> <para> - When PHP parses a file, it looks for opening and closing tags, - which tell PHP to start and stop interpreting the code between - them. Parsing in this manner allows php to be embedded in all - sorts of different documents, as everything outside of a pair - of opening and closing tags is ignored by the PHP parser. - Most of the time you will see php embedded in HTML documents, + When PHP parses a file, it looks for opening and closing tags, + which tell PHP to start and stop interpreting the code between + them. Parsing in this manner allows PHP to be embedded in all + sorts of different documents, as everything outside of a pair + of opening and closing tags is ignored by the PHP parser. + Most of the time you will see PHP embedded in HTML documents, as in this example. <informalexample> <programlisting role="php"> @@ -29,22 +29,22 @@ <programlisting role="php"> <![CDATA[ <?php -if ($expression) { +if ($expression) { ?> <strong>This is true.</strong> - <?php -} else { + <?php +} else { ?> <strong>This is false.</strong> - <?php + <?php } ?> ]]> </programlisting> </example> This works as expected, because when PHP hits the ?&gt; closing - tags, it simply starts outputting whatever it finds (except for an - immediately following newline - see + tags, it simply starts outputting whatever it finds (except for an + immediately following newline - see <link linkend="language.basic-syntax.instruction-separation">instruction separation</link> ) until it hits another opening tag. The example given here is contrived, of @@ -54,21 +54,21 @@ <function>print</function>. </para> <para> - There are four different pairs of opening and closing tags - which can be used in php. Two of those, &lt;?php ?&gt; and + There are four different pairs of opening and closing tags + which can be used in PHP. Two of those, &lt;?php ?&gt; and &lt;script language="php"&gt; &lt;/script&gt;, are always available. - The other two are short tags and <productname>ASP</productname> - style tags, and can be turned on and off from the &php.ini; - configuration file. As such, while some people find short tags - and <productname>ASP</productname> style tags convenient, they + The other two are short tags and <productname>ASP</productname> + style tags, and can be turned on and off from the &php.ini; + configuration file. As such, while some people find short tags + and <productname>ASP</productname> style tags convenient, they are less portable, and generally not recommended. <note> <para> - Also note that if you are embedding PHP within XML or XHTML - you will need to use the &lt;?php ?&gt; tags to remain + Also note that if you are embedding PHP within XML or XHTML + you will need to use the &lt;?php ?&gt; tags to remain compliant with standards. </para> - </note> + </note> </para> <para> <example> @@ -92,18 +92,18 @@ </example> </para> <para> - While the tags seen in examples one and two are both - always available, example one is the most commonly - used, and recommended, of the two. + While the tags seen in examples one and two are both + always available, example one is the most commonly + used, and recommended, of the two. </para> <para> - Short tags (example three) are only available when they are - enabled via the <link linkend="ini.short-open-tag">short_open_tag</link> - &php.ini; configuration file directive, or if php was configured + Short tags (example three) are only available when they are + enabled via the <link linkend="ini.short-open-tag">short_open_tag</link> + &php.ini; configuration file directive, or if PHP was configured with the <option>--enable-short-tags</option> option. - </para> + </para> <para> - <productname>ASP</productname> style tags (example four) are only available when + <productname>ASP</productname> style tags (example four) are only available when they are enabled via the <link linkend="ini.asp-tags">asp_tags</link> &php.ini; configuration file directive. </para> @@ -124,10 +124,10 @@ <para> As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag - of a block of PHP code automatically implies a semicolon; you - do not need to have a semicolon terminating the last line of a + of a block of PHP code automatically implies a semicolon; you + do not need to have a semicolon terminating the last line of a PHP block. The closing tag for the block will include the immediately - trailing newline if one is present. + trailing newline if one is present. <informalexample> <programlisting role="php"> <![CDATA[ @@ -143,19 +143,19 @@ </informalexample> <note> <para> - The closing tag of a PHP block at the end of a file is optional, + The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using <function>include</function> or <function>require</function>, so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace - at the end of the parts generated by the included files. + at the end of the parts generated by the included files. </para> </note> - </para> + </para> </sect1> <sect1 xml:id="language.basic-syntax.comments"> - <title>Comments</title> + <title>Comments</title> <para> PHP supports 'C', 'C++' and Unix shell-style (Perl style) comments. For example: @@ -176,7 +176,7 @@ <simpara> The "one-line" comment styles only comment to the end of the line or the current block of PHP code, whichever comes first. - This means that HTML code after <literal>// ... ?&gt;</literal> + This means that HTML code after <literal>// ... ?&gt;</literal> or <literal># ... ?&gt;</literal> WILL be printed: ?&gt; breaks out of PHP mode and returns to HTML mode, and <literal>//</literal> or <literal>#</literal> cannot influence that. @@ -194,7 +194,7 @@ <p>The header above will say 'This is an example'.</p> ]]> </programlisting> - </informalexample> + </informalexample> </para> <simpara> 'C' style comments end at the first <literal>*/</literal> encountered. @@ -206,7 +206,7 @@ <programlisting role="php"> <![CDATA[ <?php - /* + /* echo 'This is a test'; /* This comment will cause a problem */ */ ?> @@ -216,7 +216,7 @@ </para> </sect1> </chapter> - + <!-- Keep this comment at the end of the file Local variables: mode: sgml

« previous php.doc.cvs (#4352) next »