Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6884167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:28:25+00:00 2026-05-27T05:28:25+00:00

Can Anyone Explain me why : <?php for ($i = ‘a’; $i <= ‘z’;

  • 0

Can Anyone Explain me why :

    <?php
    for ($i = 'a'; $i <= 'z'; $i++){
    echo "$i ";
    }
    ?>

Why its Output is :

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 ax ay az ba bb bc
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 ej ek el em en eo ep eq
er es et eu ev ew ex… on to yz

But its Working Fine With

    <?php
    for ($i = 'a'; $i != 'aa'; $i++){
    echo "$i ";
    }
    ?>

The loop seems to run over and over again until it reaches “zz”.

If I give $i<"aa" it should work fine but instead it outputs only “a”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:28:26+00:00Added an answer on May 27, 2026 at 5:28 am

    See the manual for the increment operator:

    PHP follows Perl’s convention when dealing with arithmetic operations
    on character variables and not C’s. For example, in PHP and Perl $a =
    ‘Z’; $a++; turns $a into ‘AA’, while in C a = ‘Z’; a++; turns a into
    ‘[‘ (ASCII value of ‘Z’ is 90, ASCII value of ‘[‘ is 91). Note that
    character variables can be incremented but not decremented and even so
    only plain ASCII characters (a-z and A-Z) are supported.
    Incrementing/decrementing other character variables has no effect, the
    original string is unchanged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain how to make this code work? echo '<div id=panel1-under>Welcome <?php echo
Can anyone explain how to run PHP code from within javaScript for submit? Currently
working PHP probably on amazon ec2... can anyone explain what would be the best
Can anyone explain the following PHP Code ? function get_param($param_name, $param_type = 0) {
Can anyone explain what the following PHP Code does function query($query_string) { if ($query_string
Can anyone explain to me what this means? Run-Time Check Failure #0 - The
I am a noob to PHP can anyone explain me whats Pear DB library
Can anyone explain why on PHP 5.2.9 this statement evaluates to true instead of
Looking at referencing in PHP is pretty much confusing me, can anyone explain to
Can anyone explain to me why this rewrite rule doens't work: RewriteRule ^architecture/([a-zA-Z_]+)/(.*).html$ web/index.php?field=1&sub=$1&name=$2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.