cvs: phpdoc /en/language operators.xml variables.xml

From: Date: Tue, 22 Apr 2003 02:19:50 +0000
Subject: cvs: phpdoc /en/language operators.xml variables.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969352794@lists.php.net to get a copy of this message
alindeman Mon Apr 21 22:19:50 2003 EDT Modified files: /phpdoc/en/language operators.xml variables.xml Log: -as discussed with philip, my example about character decrementation was a bit too long. -moved discussion and examples about increment and decrement operators to the correct section. Index: phpdoc/en/language/operators.xml diff -u phpdoc/en/language/operators.xml:1.46 phpdoc/en/language/operators.xml:1.47 --- phpdoc/en/language/operators.xml:1.46 Tue Mar 18 04:21:07 2003 +++ phpdoc/en/language/operators.xml Mon Apr 21 22:19:50 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.46 $ --> +<!-- $Revision: 1.47 $ --> <chapter id="language.operators"> <title>Operators</title> <simpara> @@ -600,6 +600,40 @@ </programlisting> </informalexample> </para> + <para> + PHP follows Perl's convention when dealing with arithmetic operations + on character variables and not C's. For example, in Perl 'Z'+1 turns + into 'AA', while in C 'Z'+1 turns into '[' { ord('Z') == 90, ord('[') == 91 ). + <example> + <title>Arithmetric Operations on Character Variables</title> + <programlisting role="php"> +<![CDATA[ +<?php +$i = 'W'; +for($n=0; $n<6; $n++) + echo ++$i . "\n"; + +/* + Produces the output similar to the following: + +X +Y +Z +AA +AB +AC + +*/ +?> +]]> + </programlisting> + </example> + </para> + <note> + <simpara> + Character variables can be incremented but not decremented. + </simpara> + </note> </sect1> <sect1 id="language.operators.logical"> Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.57 phpdoc/en/language/variables.xml:1.58 --- phpdoc/en/language/variables.xml:1.57 Mon Apr 21 18:33:13 2003 +++ phpdoc/en/language/variables.xml Mon Apr 21 22:19:50 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.57 $ --> +<!-- $Revision: 1.58 $ --> <chapter id="language.variables"> <title>Variables</title> @@ -109,51 +109,6 @@ </programlisting> </informalexample> </para> - <para> - PHP follows Perl's convention when dealing with arithmetic operations - on character variables and not C's. For example, in Perl 'Z'+1 turns - into 'AA', while in C 'Z'+1 turns into '[' { ord('Z') == 90, ord('[') == 91 ). - <example> - <title>Arithmetric Operations on Character Variables</title> - <programlisting role="php"> -<![CDATA[ -<?php -$i = 'W'; -for($n=0; $n<6; $n++) - echo ++$i . "\n"; - -/* - Produces the output similar to the following: - -X -Y -Z -AA -AB -AC - -*/ -?> -]]> - </programlisting> - </example> - </para> - <para> - Note that you cannot decrement a string, only increment it. - <example> - <title>Arithmetric Operations on Character Variables (example 2)</title> - <programlisting role="php"> -<![CDATA[ -<?php -$x = 'a'; - -$x++; //$x now equals 'b' -$x--; //this doesn't work, $x still equals 'b' -?> -]]> - </programlisting> - </example> - </para> </sect1> <sect1 id="language.variables.predefined">

« previous php.doc (#969352794) next »