PHP Bitwise Operators - PHP Tutorial 34

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024
  • Notes for You:: PHP Bitwise Operators - PHP Tutorial 34
    are used to perform operations on bits.
    Bitwise operators convert the given decimal number(s) to their binary equivalent number, and then they perform the operation on those bits and return the result in the form of decimal.
    &: Bitwise And operator:
    If both LHS and RHS operands are 1 then the result will be 1, in all other cases result will be 0.
    |: Bitwise Or operator:
    If both LHS and RHS operands are 0 then the result will be 0, in all other cases result will be 1.
    ^: Bitwise Exclusive Or operator:
    If both LHS and RHS operands are same bits then the result will be 0, otherwise the result will be 1.
    ~: Bitwise complement operator:
    Add 1 to the given number and change the sign.
    <<: Bitwise Left Shift operator:
    Shifts the bits of first number to the left by number of positions indicated by second number.
    firstNumber * pow(2,secondNumber).
    >>: Bitwise Right Shift operator:
    Shifts the bits of first number to the right by number of positions indicates by second number.
    firstNumber / pow(2,secondNumber).
    Example Code:
    echo 1 & 1,"<br/>"; //1
    echo 2 & 5,"<br/>"; // 0
    echo "<br/>";
    echo 1 | 1,"<br/>"; //1
    echo 2 | 5,"<br/>"; // 7
    echo "<br/>";
    echo 1 ^ 1,"<br/>"; //0
    echo 2 ^ 5,"<br/>"; // 7
    echo "<br/>";
    echo ~3,"<br/>"; //-4
    echo ~(-3),"<br/>"; //2
    echo "<br/>";
    echo 1<<4,"<br/>"; // 16
    echo 12<<2,"<br/>"; // 48
    echo "<br/>";
    echo 16>>4,"<br/>"; // 1
    echo 48>>2,"<br/>"; // 12
    Note:
    replace < with less-than symbol.
    replace > with greater-than symbol.
    =========================================
    Follow the link for next video:
    PHP Tutorial 35 - String Operators in PHP | PHP String Operators Tutorial
    • PHP String Operators -...
    Follow the link for previous video:
    PHP Tutorial 33 - PHP Binary to Decimal Conversion | PHP Decimal to Binary Conversion
    • PHP bindec( ) and dec...
    =========================================
    PHP Tutorials Playlist:-
    • PHP Tutorials
    =========================================
    Watch My Other Useful Tutorials:-
    MySQL Tutorials Playlist:-
    • MySQL Tutorials
    HTML Tutorials Playlist:-
    • HTML Tutorials
    CSS Tutorials Playlist:-
    • CSS Tutorials
    JavaScript Tutorials Playlist:-
    • JavaScript Tutorials
    =========================================
    ► Subscribe to our TH-cam channel:
    / chidrestechtutorials
    ► Visit our Website:
    www.chidrestec...
    =========================================
    Hash Tags:-
    #ChidresTechTutorials #PHP #PHPTutorial

ความคิดเห็น • 8

  • @ChidresTechTutorials
    @ChidresTechTutorials  5 ปีที่แล้ว +1

    SUBSCRIBE, SHARE & SUPPORT:
    th-cam.com/users/chidrestechtutorials
    VISIT & LEARN AT FREE OF COST:
    ​www.chidrestechtutorials.com

  • @KrishnamanoharCh
    @KrishnamanoharCh 8 หลายเดือนก่อน +1

    Very good

  • @sontosh007
    @sontosh007 4 ปีที่แล้ว +1

    Thanks

  • @ChayonShaahOfficial
    @ChayonShaahOfficial 4 ปีที่แล้ว +1

    Very Nice man

    • @ChidresTechTutorials
      @ChidresTechTutorials  4 ปีที่แล้ว

      Thank you. Make sure you share with your friends and help them in learning at free of cost. Keep learning , keep coding & keep sharing !!!

  • @petruconiuc4618
    @petruconiuc4618 4 ปีที่แล้ว +1

    Very impressive, but will happen if i write something like: 011 & 11? for some reasons its different than 11 & 11

    • @ChidresTechTutorials
      @ChidresTechTutorials  4 ปีที่แล้ว

      Note:
      if you prefix 0 to a number it is considered as octal number , not as decimal number so you find the difference in the output