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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:07:44+00:00 2026-05-24T14:07:44+00:00

Can Some body will help me how can I genrete 5 digit code like

  • 0

Can Some body will help me how can I genrete 5 digit code like if I have a code Like

00001
00002
.
.
.
00009

and then after this it should come back like below
00019
.
.
99999

Please can somebody help me which type of loop I have to do to increment forward and decrements backward.

Many thanks

  • 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-24T14:07:45+00:00Added an answer on May 24, 2026 at 2:07 pm

    Using str_pad() to produce a string of constant length, padded by zeros on the left :

    for ($i=1 ; $i<10000 ; $i++) {
        echo str_pad($i, 5, '0', STR_PAD_LEFT) . '<br />';
    }
    

    And, to go backwards, just change the starting value, condition, and use a decrement in your for loop :

    for ($i=99999 ; $i>0 ; $i--) {
        echo str_pad($i, 5, '0', STR_PAD_LEFT) . '<br />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi can some body help me how to call process.existed() method in c#? Actually
I'd like some help with the following jQuery code if possible... $(document).ready(function() { $('table.sortable').each(function()
Can somebody help me with this. There is HTML code: <h3> <label> <input type=checkbox
I'm trying to create some javascript code that will display a javascript form (from
I have a slightly tricky one here I hope the community can help me
Can somebody advise me what this code does and how can I convert it
I am currently loading HTMl content via AJAX. I have code for things on
I hope you can help me with this. I've been using jquery datepicker in
I need some help in bison grammar construction. From my another question: I'm trying
I need some help on how to set up this page. Let's say I

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.