Possible Duplicate:
Reference – What does this symbol mean in PHP?
What does the << mean in this line of PHP?
$count = (1 << $count_log2) - 1;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
this is the shift left operator.
so in your example you are shifting left the value 1 , $count_log2 times to the left.
so the value is 2^count_log2.
1 in 8 bit binary is 00000001
so if $count_log2 = 4, we need to get 2^4 = 16.
shifting left means moving the 1 left 4 times (since $count_log2 = 4).
lets do the steps.
so we got 2^4.
a common reason for using shift operation is that it takes less time for the processor to do a shift operation than using multiplication.