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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:53:12+00:00 2026-05-18T19:53:12+00:00

Why does / . date(Y) + 1 in PHP return 1 ? And a

  • 0

Why does
"/" . date("Y") + 1 in PHP return 1?

And a similar question, why does date("Y") . "/" . date("Y") + 1 return 2011?

I am quessing it has something to do with operator precedence, because date("Y") . "/" . (date("Y") + 1) does return the expected "2010/2011"

  • 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-18T19:53:13+00:00Added an answer on May 18, 2026 at 7:53 pm

    Yep. . binds more tightly than +, so:

    "/" . date("Y") + 1
    

    is parsed as:

    ("/" . date("Y")) + 1
    

    The left side doesn’t start with any numbers, so when you convert it to a number, it becomes 0. Same with the latter:

    (date("Y") . "/" . date("Y")) + 1
    

    The left side of the + starts with 2010 then some non-digits, so when it gets converted to a number, it becomes 2010. Then you add 1.

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

Sidebar

Related Questions

Why does / . date(Y) + 1 in PHP return 1 ? And a
Why PHP preg_replace {include 'date.php'} does not return php? How to solve it without
Here is date format function in PHP. function formatMyDateNicely($strTimeString) { return date('F j, y
function convertDates($timestamp) { return date('Y-m-d', $timestamp); } $days = array(); //storing databases php time();
Does anybody know which date format is to be used, trying to create a
How does one set the date on the CalendarDatePicker. i.e. it defaults to current
Does anyone have a good way of deleting duplicate transactions (same date, amount, biller,
Does anybody have any advice on working in a Date Driven Development environment? Essentially,
Does anyone know know how to programatically get the local date and time of
Does anyone have a good algorithm to calculate what date Good Friday falls on

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.