Find a funny little thing to ask the principle

Source: Internet
Author: User
Find a funny little thing to ask the principle
Today originally wanted to write an export Excle package class, considering that Excle is from the column is the English alphabet of a-Z Aa-az to ZZ Aaaaaz such a rule of infinite recursion 26, on the degree Niang above read the information found a piece of code
PHP Code
  
   for ($i = ' A '; $i <= ' Z '; $i + +) {    echo "$i \ n";}

Output results
――――――――――――――――――――――――――――――――――――――――――
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 an AO AP AQ AR as at AU AV AW A X AY AZ BA BB BC BD is 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 el EJ EK EL EM EN EO EP EQ ER ES ET EU EV EW EX EY EZ FA FB FC FD FE FF FG FH FI FJ FK FL FM FN FO F P FQ FR FS FT FU FV FW FX FY FZ GA GB GC GD GE GF GG GH GI GJ GK GL GM GN GO GP GQ GR GS GT GU GV GW GX GY GZ HA HB HC HD HE HF HG HH HI HJ HK HL HM HN HO HP HQ HR HS HT HU HV HW HX HY HZ IA IB IC ID IE IF IG IH II IJ IK IL IM in IO IP IQ IR is IT IU IV IW IX IY IZ JA JB JC JD JE JF JG JH JI JJ JK JL JM JN JO JP JQ JR JS JT JU JV JW JX JY JZ KA KB KC KD KE KF KG K H KI KJ KK KL miles KN KO KP KQ KR KS KT KU KV KW KX KY KZ LA LB LC LD LE LF LG LH LI LJ LK LL LM LN LO LP LQ LR LS LT LU LV LW LX LY LZ MA MB MC MDME MF MG MH MI MJ MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NB NC ND NE NF NG NH NI NJ NK NL NM NN NO NP NQ NR NS NT NU NV NW NX NY NZ OA OB OC OD OE of OG OH OI OJ OK OL OM on OO OP OQ OR OS OT OU OV OW OX OY OZ PA PB PC PD PE PF PG P H PI PJ PK PL PM PN PO PP PQ PR PS PT PU PV PW PX PY PZ QA QB QC QD QE QF QG QH QI QJ QK QL QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ RA RB RC RD RE RF RG RH RI RJ RK RL RM RN RO RP RQ RR RS RT RU RV RW RX RY RZ SA SB SC SD SE SF SG SH SI SJ SK SL SM SN so SP SQ SRS SS ST SU SV SW SX SY SZ TA TB TC TD TE TF TG TH TI TJ TK TL TM TN to TP TQ TR TS TT TU TV TW TX TY T Z UA UB UC UD UE UF UG UH UI UJ UK UL UM UN UO up UQ UR US UT UU UV UW UX UY UZ VA VB VC VD VE VF VG VH VI VJ VK VL VM VN VO VP VQ VR VS VT VU VV VW VX VY VZ WA WB WC WD WE WF WG WH WI WJ WK WL WM WN WO WP WQ WR WS WT WU WV WW WX WY WZ XA XB XC XD XE XF XG XH XI XJ XK XL XM XN XO XP XQ XR XS XT XU XV XW XX XY XZ YA YB YC YD YE YF YG YH YI YJ YK YL YM YN YO YP YQ Y R YS YT YU yv YW YX YY YZ
――――――――――――――――――――――――――――――――――――


Then it is found that the test must use the self-increment to output function if $i= $i +1; So that's the kanji, not the letters.

And then test the self-increment
PHP Code
  
   for ($i = ' A '; $i <= ' Z ' +1; $i + +) {    echo "$i \ n";}

The output is a-Z-az-abc ABD .... The browser is not going to fit

And then I changed the wording.
PHP Code
  
   $i = ' A '; for ($j =0; $j <100000; $j + +) {    $i + +;} echo "$i";


Output Eqxe

Who can explain why this is the case, only PHP or the other have this commonality? Explore each other

------Solution--------------------
Perl Habits


The ' z ' + result is ' AA ', but the string ' AA ' < ' z ', so ... All the problems are out.
------Solution--------------------
This is the nature of PHP, $i is the same as the number, when the letter is not the same
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.