Click here to get back home

What is << ?

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
What is << ? mab464 07-14-2008
|   | ---> Re: What is << ? The Natural Phi...07-16-2008
|   |     `--> Re: What is << ? The Natural Phi...07-16-2008
Get Chitika Premium
Posted by mab464 on July 14, 2008, 6:13 am
Please log in for more thread options
I was taking an online PHP test and got the question

What will the output of the following statement be

echo 4<<5;

After the test, I searched google but couldn't find any such
operator/construct.
Can any one explain what '<<' does?

Thanks


Posted by Jensen Somers on July 14, 2008, 5:41 am
Please log in for more thread options
Hello,

mab464 wrote:
> I was taking an online PHP test and got the question
>
> What will the output of the following statement be
>
> echo 4<<5;
>
> After the test, I searched google but couldn't find any such
> operator/construct.
> Can any one explain what '<<' does?
>
> Thanks

That's a bitwise operation.

You can find more information about bitwise operations at
http://be.php.net/language.operators.bitwise.

- Jensen

Posted by sathyashrayan on July 14, 2008, 5:43 am
Please log in for more thread options

>I was taking an online PHP test and got the question
>
> What will the output of the following statement be
>
> echo 4<<5;
>
> After the test, I searched google but couldn't find any such
> operator/construct.
> Can any one explain what '<<' does?
>
> Thanks

search for "computer number system" in google, then search for base 2
numbers.Then come to bit operators.



Posted by Tim Roberts on July 16, 2008, 2:24 am
Please log in for more thread options
>
>>I was taking an online PHP test and got the question
>>
>> What will the output of the following statement be
>>
>> echo 4<<5;
>>
>> After the test, I searched google but couldn't find any such
>> operator/construct.
>> Can any one explain what '<<' does?
>
>search for "computer number system" in google, then search for base 2
>numbers.Then come to bit operators.

I find that to be odd advice. I'm very much in favor of "Google it" as a
first-stage answer, but your search terms would imply that the << operator
is a generic part of binary arithmetic. That's not true. The << operator
was a C language invention, and in order to learn that "<<" is the "left
shift operator", you have to stumble upon a reference for a programming
language that implements it.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Posted by sathyashrayan on July 16, 2008, 2:53 am
Please log in for more thread options

>>
>>>I was taking an online PHP test and got the question
>>>
>>> What will the output of the following statement be
>>>
>>> echo 4<<5;
>>>
>>> After the test, I searched google but couldn't find any such
>>> operator/construct.
>>> Can any one explain what '<<' does?
>>
>>search for "computer number system" in google, then search for base 2
>>numbers.Then come to bit operators.
>
> I find that to be odd advice. I'm very much in favor of "Google it" as a
> first-stage answer, but your search terms would imply that the << operator
> is a generic part of binary arithmetic. That's not true. The << operator
> was a C language invention, and in order to learn that "<<" is the "left
> shift operator", you have to stumble upon a reference for a programming
> language that implements it.

opps.. got it.. you are correct.. Boolean logic never talks about shifts.
Shifts are Register specific..
Correct me if i am wrong..




Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap