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 8914563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:45:14+00:00 2026-06-15T04:45:14+00:00

i was read this document document they can loop from A to Z with

  • 0

i was read this document document

they can loop from A to Z with this code.

$string = 'A';
for ( $i = 0; $i<=1; $i++ ) {
    echo $string;
    ++$string;
}

and result can go from A to B or more than this up to $i

but!!

i can’t do loop from Z to A with this code

--$string;

Does anyone know how to loop from Z to A?

ps1. i can’t use range(); because ‘Z’ is in variable.

ps2. this is excel column that can go from A to Z, AA, AB or more then this.. so, i can’t use variable in range or number to character.

  • 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-06-15T04:45:17+00:00Added an answer on June 15, 2026 at 4:45 am

    You can try

    $range = range("Z", "A");
    foreach ( $range as $chr ) {
        echo $chr;
    }
    

    Output

    ZYXWVUTSRQPONMLKJIHGFEDCBA
    

    If you must start with Z

    $s = 'Z';
    while($s != "@"){
        print($s) and $s = chr(ord($s) - 1);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I usually do not have difficulty to read JavaScript code but for this one
I read this code in a library which is used to display a bitmap
I read this story on slashdot today where they announce a new parallel programming
I read this article where Ayende states NHibernate can (compared to EF 4): Collection
This probably has been asked before but all I can find are questions regarding
I know this might be a no-brainer, but please read on. I also know
I can't read the full title of my Google Calendar events, because they're truncated
I have a query that looks like this Document document = DocDAO.getSession().read(someId); MyFile file
I'm using the apache POI to read Word documents. I'm using this example as
I read this question in stackoverflow. The excerpt answer provided by bbum is below:

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.