What is << ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mab464

    What is << ?

    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

  • Jensen Somers

    #2
    Re: What is &lt;&lt; ?

    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

    Comment

    • sathyashrayan

      #3
      Re: What is &lt;&lt; ?


      "mab464" <mab464@gmail.c omwrote in message
      news:g5f5bn$uba $1@registered.m otzarella.org.. .
      >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.


      Comment

      • D. Stussy

        #4
        Re: What is &lt;&lt; ?

        "mab464" <mab464@gmail.c omwrote in message
        news:g5f5bn$uba $1@registered.m otzarella.org.. .
        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?
        128.


        Comment

        • The Natural Philosopher

          #5
          Re: What is &lt;&lt; ?

          D. Stussy wrote:
          "mab464" <mab464@gmail.c omwrote in message
          news:g5f5bn$uba $1@registered.m otzarella.org.. .
          >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?
          >
          128.
          >
          >
          42

          Comment

          • D. Stussy

            #6
            Re: What is &lt;&lt; ?

            "The Natural Philosopher" <a@b.cwrote in message
            news:1216245635 .2284.1@proxy00 .news.clara.net ...
            D. Stussy wrote:
            "mab464" <mab464@gmail.c omwrote in message
            news:g5f5bn$uba $1@registered.m otzarella.org.. .
            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?
            128.
            >
            42
            Wrong. Not possible. To get 42, one would have to use "base 31.5," but
            half a digit isn't possible, nor does it make sense.


            Comment

            • Twayne

              #7
              Re: What is &lt;&lt; ?

              "The Natural Philosopher" <a@b.cwrote in message
              news:1216245635 .2284.1@proxy00 .news.clara.net ...
              >D. Stussy wrote:
              >>"mab464" <mab464@gmail.c omwrote in message
              >>news:g5f5bn$u ba$1@registered .motzarella.org ...
              >>>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?
              >>>
              >>128.
              >>
              >42
              >
              Wrong. Not possible. To get 42, one would have to use "base 31.5,"
              but half a digit isn't possible, nor does it make sense.
              Not impossible, just improbable. If one wants the answer to the meaning
              of life, that's the sort of work one must go thru. <g>


              Comment

              • Jerry Stuckle

                #8
                Re: What is &lt;&lt; ?

                D. Stussy wrote:
                "The Natural Philosopher" <a@b.cwrote in message
                news:1216245635 .2284.1@proxy00 .news.clara.net ...
                >D. Stussy wrote:
                >>"mab464" <mab464@gmail.c omwrote in message
                >>news:g5f5bn$u ba$1@registered .motzarella.org ...
                >>>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?
                >>128.
                >42
                >
                Wrong. Not possible. To get 42, one would have to use "base 31.5," but
                half a digit isn't possible, nor does it make sense.
                >
                >
                >
                Whoosh!

                (That's the sound of a joke going right over your head) :-)

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • The Natural Philosopher

                  #9
                  Re: What is &lt;&lt; ?

                  D. Stussy wrote:
                  "The Natural Philosopher" <a@b.cwrote in message
                  news:1216245635 .2284.1@proxy00 .news.clara.net ...
                  >D. Stussy wrote:
                  >>"mab464" <mab464@gmail.c omwrote in message
                  >>news:g5f5bn$u ba$1@registered .motzarella.org ...
                  >>>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?
                  >>128.
                  >42
                  >
                  Wrong. Not possible. To get 42, one would have to use "base 31.5," but
                  half a digit isn't possible, nor does it make sense.
                  >
                  >
                  I am impressed that you even tried to make sense of it.

                  Comment

                  Working...