Home PHP Ajax Regex Interviews Contact us    

PHP


Interview Questions


Bitwise Operators

Bitwise operators allow you to turn specific bits within an integer on or off. If both the left- and right-hand parameters are strings, the bitwise operator will operate on the characters in this string.

OperatorNameResult
$a & $bAndBits that are set in both $a and $b are set.
$a | $bOrBits that are set in either $a or $b are set.
$a ^ $bXor Bits that are set in $a or $b but not both are set.
~ $aNot Bits that are set in $a are not set, and vice versa.
$a << $bShift left Shift the bits of $a $b steps to the left (each step means "multiply by two")
$a >> $bShift right Shift the bits of $a $b steps to the right (each step means "divide by two")

Example

<?php
$a = 10 ;
$b = 10 ;
$c = 10 ;
 if( $a==$b & $b==$c )
   echo "a,b and c are equal";
 else
   echo "a,b and c are not equal";

?>


Feed Back of this Topic
 
Name :
Email :
Topic :
Comments :

Ajax


Regular Expression


 
Copyright © 2007 123developers.com
Contact us | Disclaimer