I found an interesting little thing. how is it?-php Tutorial

Source: Internet
Author: User
I found an interesting little thing to ask about the principle. today I wanted to write an exclusive encapsulation class for exporting excle, considering that excle is a regular, infinite recursion of the 26 hexadecimal system from the A-ZAA-AZ of English letters to ZZAAAAAZ, I read the following information and found a piece of code PHPcodefor ($ iA; $ I & lt; Z; $ I ++) {echo & quot; $ in & quot discover an interesting little things
Today I would like to write an export excle encapsulation class, considering that excle is from the column is an English letter arrangement of A-Z AA-AZ to ZZ AAAAAZ such a regular infinite recursive 26 hexadecimal, I read the document above and found a piece of code.
PHP code
  for ($i = 'A'; $i <= 'Z'; $i++){    echo "$i\n";}

Output result
------------------------------------------
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 AO AP AQ AR AS AT AU AV AW AX AY AZ BA BB BD BE 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 Ezek 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 FP 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 Tianji JJ JK JL JM JN JO JQ JR JS JT JU JV JW JX JY JZ KA KB KC KD KE KF KG KH KI KJ KK KL KM 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 SCSI LR LS LT LU LV LW LX LY LZ MA MB MC MD ME 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 PH PI PJ PK PL PM PN PO 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 SR 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 TZ UA 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 VL VI VJ VK VL VM VN VO 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 XP XQ XR XS XT XU XV XW XX XY XZ YA YB YC YD YE YF YG YH YI YJ YL YM YN YO YP YQ YR YS YT YU YV YW YX YY YZ
------------------------------------


Then it is found that the test must use auto-increment to output the function. if $ I = $ I + 1 is used, it is a Chinese character, not a letter.

Then test auto-increment.
PHP code
  for ($i = 'A'; $i <= 'Z'+1; $i++){    echo "$i\n";}

The output is A-Z-AZ-abc abd... the browser cannot support it.

Then I changed the writing method.
PHP code
  $i = 'A';for($j=0;$j<100000;$j++){    $i++;}echo "$i";


Output EQXE

Who can explain why only php and others share this commonality? Mutual discussion

------ Solution --------------------
Perl habits


'Z' ++ returns 'A', but the string 'A' <'Z', so ...... All problems have come out.
------ Solution --------------------
This is a PHP feature. $ I is the same when it is a number, and it is different when it is a letter.

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.