First of all, the magic of PHP is supported by character data types, some students wrote such a code:
for ($c = ' a '; $c <= ' z '; $c + +) {
Echo $c. ' ';
}
But it turns out it's not the A to Z he wants.
A b c d e F g h i j k l m n o p q R S t u v w x y z aa ab AC ad AE af ag ah ai
AJ Ak al am a AO ap aq ar as at au av aw ax ay az ba bb BC BD AM BF bg BH
BI BJ BK bl bm bn bo BP bq br bs BT BU BV bw BX by BZ CA CB CC CD CE CF CG
Ch CI cj CK cl cm CN CO CP CQ CR CS CT CU CV cw cx cy CZ da DB DC dd de DF
dg DH di dj DK dl DM DN Do DP dq Dr ds dt du dv DW dx dy DZ ea EB ec Ed Ee
EF eg eh ei ej ek el em en eo ep eq er es et eu ev ew ex ... On to YZ
There are more than n ways to achieve A to Z print, such as the following
for ($i = ' a '; $i!= ' AA '; $i + +)
Echo $i. ' ';
for ($i = Ord (' a '); $i <= ord (' z '); $i + +)
echo chr ($i). ' ';
echo implode (', Range (' A ', ' Z '));
But we're going to have to explain what kind of ghosts are on the print list.
This is because in the arithmetic operation of a single character variable, PHP follows the usage of Perl rather than c.
In Perl
$a = ' Z ';
$a + +; ' AA '
In C
A = ' Z ';
a++; ' [' because the ASCII value of ' Z ' is 90, ' [' The ASCII value is 91
Note that character variables can only be incremented, cannot be decremented, and only plain letters (A-Z and A-Z) are supported and are visible as follows:
$a = "9F9";
$b = "9F9";
Var_dump (+ + $a); "9g0"
Var_dump (--$b); "9F9" does not change
And then there's this kind of classmate crying.
$a = "9E0";
Var_dump (+ + $a); Float (10)
#这TM又变成科学计数法了啊 ...
PHP never sets the cards by the routine!