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

  • Home
  • SEARCH
  • 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 505605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:36:57+00:00 2026-05-13T06:36:57+00:00

This is a math problem, but I’m sure this must come up in some

  • 0

This is a math problem, but I’m sure this must come up in some programming scenarios, at least I hope so, and I was wondering if there was a name for this type of situation:

Suppose I have 7 items in a series. For the sake of this example, let’s use days of the week. I would like a user to submit which days of the week they plan to come in the following week. They are presented with a standard series of checkboxes, one for each day of the week.

I would like to store which days they choose in one database field as a single integer.

Obviously, I could assign each day a number, 1 – 7 (leaving 0 out in case the user leaves all choices unchecked). But then I run into problems if one user chooses Monday and Tuesday ( 1 + 2) and another chooses Wednesday (3).

I could also give each day of the week some bizarre unique such that it was impossible for any combination of digits to be identical to any other combination.

My hope is that rather than make up such a series for the second scenario, some numerical property already exists (perhaps the square of each number in the series, etc) that is already well-used and respected. Ideally, this would be so familiar to programming, that deriving the individual digits would take very little overhead of a common programming language (in my case PHP).

Did I just dream this up, or does something like this exist?

  • 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-13T06:36:57+00:00Added an answer on May 13, 2026 at 6:36 am

    Use a bitmask – powers of 2.

    Monday = 2 ^ 0 = 1
    Tuesday = 2 ^ 1 = 2
    

    and so on. Then Monday and Tuesday becomes:

    Monday | Tuesday = 3 (or 00000011 in binary)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.