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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:29:51+00:00 2026-06-12T03:29:51+00:00

Possible Duplicate: How to increment date with 1 (day/year) in PHP? Im not really

  • 0

Possible Duplicate:
How to increment date with 1 (day/year) in PHP?

Im not really sure where to begin with this but im trying to make a year start at 1928 and stop at 1948 and for every year the years increment by one so since its 2012 the date ranges are 1928 – 1948 and for 2013 it would be 1929 – 1949 and 2014 would be 1930 – 1950 and so on…

right now i just have a basic loop for when to start and stop the years but its not too dynamic, like i said im pretty much at a blank on where to begin other then date(‘Y’)+1.

for($i=1928;$i<=date('Y');$i++)
{
    echo '<option value='.$i.'>'.$i.'</option>';
    if($i == '1948'){break;}
}
  • 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-12T03:29:52+00:00Added an answer on June 12, 2026 at 3:29 am

    So you want it to go between current year minus 84 and the current year minus 64? Use this code:

    $firstYear = (int)date('Y') - 84;
    $lastYear = $firstYear + 20;
    for($i=$firstYear;$i<=$lastYear;$i++)
    {
        echo '<option value='.$i.'>'.$i.'</option>';
    }
    

    Edit: updated for performance. Current year is determined before the loop (per Pitchinnate’s comment).

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

Sidebar

Related Questions

Possible Duplicate: How can I increment a date by one day in Java? public
Possible Duplicate: Simplest way to increment a date in PHP? I am very new
Possible Duplicate: Why does this code not increment a counter properly? I have a
Possible Duplicate: How can I increment a date by one day in Java? I
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: What's this kind of syntax in PHP? What is the name for
Possible Duplicate: Add a field and insert an increment value I have this table
Possible Duplicate: increment date by one month I have the following code to sum
Possible Duplicate: Why does sizeof(x++) not increment x? #include<stdio.h> int main(void) { double num=5.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.