mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Documentation Bug #2965
"Why is ('Z'+1) < 'Z'?" git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@106290 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b923b607e9
commit
8779fa151a
1 changed files with 29 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.55 $ -->
|
||||
<!-- $Revision: 1.56 $ -->
|
||||
<chapter id="language.variables">
|
||||
<title>Variables</title>
|
||||
|
||||
|
@ -109,7 +109,35 @@ $bar = &test(); // Invalid.
|
|||
</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>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="language.variables.predefined">
|
||||
|
|
Loading…
Reference in a new issue