jerseyguy0
asked on
php
what is example when (($y-1 & 8) == 0) is true
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Given a set of integers $y=1,2,3... the expression is true until you reach 8. When $y is 9, the expression is false. It counts to eight. It more accurately, it returns true for y=1..8, false for 9..16, true for 17..24 and so on.
I want to set it to ten
how could I make it
Given a set of integers $y=1,2,3... the expression is true until you reach 10. When $y is 11, the expression is false. It counts to ten. It more accurately, it returns true for y=1..10, false for 11..20, true for 21..30 and so on.
but I dont think ($y-1 & 10) would work
I want to set it to ten
how could I make it
Given a set of integers $y=1,2,3... the expression is true until you reach 10. When $y is 11, the expression is false. It counts to ten. It more accurately, it returns true for y=1..10, false for 11..20, true for 21..30 and so on.
but I dont think ($y-1 & 10) would work
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
10 is what I need.
10 is the max for y
10 is the max for y
if you want to test odd or even numbers you can use:
<?php
echo "\$number is $number and it's " . ( ($number & 1) ? 'odd' : 'even' ).'.';
?>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER