You can also check to see if Integer( N/4) is odd or even.
If it is even Wednesday is set.
Main Topics
Browse All TopicsHi experts,
i have a calendar with weekdays for events.
i store this days within my database as binary string.
So if an event is on Monday Tuesday and Wednesday i store
1110000 => Monday, Tuesday, Wednesday
If an event is on Friday,Saturday and Sunday i store
0000111 = Friday, Saturday and Sunday
Now i converted it for calculation in php by using bindec() to get a decimal as result:
Example:
1110000 => (2 pow 6) + (2 pow 5) +( 2 pow 4) + 0 + 0 + 0 + 0 = 112
Now i have a big problem. For example i want to search for all events for "Wednesday" that means my expression (2 pow 4) can exists in an integer between 1 - 127.
How can i calculate all results that are possible with (2 pow 4) so that i get:
Mo + Tue + Wed => 112
Mo + Wed + Fr => 84
Wed + Sa + Su => 19
Wed + Su => 17
....
so that i get a result array(112,84,19,17......)
has anybody an idea
CU BIBA
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Use the substr() function: http://www.w3schools.com/P
Wednesday is always the third element: So substr( S, 3,1) will give you the Wed value.
Business Accounts
Answer for Membership
by: d-glitchPosted on 2009-08-14 at 05:54:28ID: 25097428
Are you using all seven days?
If so then you have 128 possibilities: 0 - 127
Exactly half of these have the Wednesday bit set.
You can make this list for each day of the week, or you can convert back
to binary and do a bit-mask test.