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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:21:04+00:00 2026-05-26T17:21:04+00:00

How do I start a for-loop with 01 as opposed to 1 ? I’ve

  • 0

How do I start a for-loop with 01 as opposed to 1? I’ve tried the below, but it doesn’t seem to work.

for ($i = 01; $i <= 12; $i++) {
    echo "<option value='$i'";
    if ($i == $post_response[expiremm]) { 
        echo " selected='selected'"; 
    }
    $month_text = date("F", mktime(0, 0, 0, $i+1, 0, 0, 0));
    echo ">$month_text</option>"; 
} 
  • 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-26T17:21:05+00:00Added an answer on May 26, 2026 at 5:21 pm

    You can’t really start an integer at 01, you will need to pad the value, probably using str_pad to prefix leading elements to a string:

    $value = $i;
    if ($i < 10) {
        $value = str_pad($i, 2, "0", STR_PAD_LEFT);
    }
    

    Note that for different unit types you will obviously need to alter the desired pad_length.

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

Sidebar

Related Questions

Shark has identified a area of code to be improved - Unaligned loop start
I start a .Net server side program on my local workstation, but soon it
hey I'm looking for are clean solution to this problem: i start the loop
Actually i want to apply a loop on accelerometer, means i want to start
Here's what I'm doing. I have a loop that fires 20 processes using Process.Start().
I have a service in a for ever loop but somehow over time it
Start a new Silverlight application... and in the code behind (in the Loaded event),
Start with a series of MS Office extensions built in C++ as COM objects.
I start by creating a string variable with some non-ascii utf-8 encoded data on
I start to write a client - server application using .net (C#) for both

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.