Home > Preview
The flashcards below were created by user
starkisspk
on FreezingBlue Flashcards.

What are the php bitwise operators?
 ~ (NOT)
 & (AND)
  (OR)
 ^ (XOR) exclusive or
 << SHIFT BITS LEFT
 >> SHIFT BITS RIGHT

Shifting a number 1 bit to the left is the same of ________ by 2
Multiplying

Shifting a number 1 bit to the right is the same of ________ by 2
Dividing

var_dump(6&3);
2
 00000110 6
 00000011 &3
 00000010 2

To find out the max value of an integer we use the constant
 'PHP_INT_MAX'To find out the size of an integer we use the constant
 'PHP_INT_SIZE'

What is the sun of the binary bits,
1 + 1 ?
10


What is the output of the following:
<?php
$a = 2;
print ~$a++;
?>
 output is 3
 //++ has higher precendent than ~ so $a++ is executed first.
 But since $a++ is postincrement the value remains 2;
 then the binary bits of 2 is negated which results in the value
 being negative 3.

What is the output of the following:
<?php
$a = 4;
print ~++$a;
?>
 output is 6
 // $a++ is preincrement the value becomes 5;
 then the binary bits of 5 is negated which results in the value being negative 6.

What is the out of :
print 20 % 3
2

what is output of :
print 0 % 8;
8

what is output of :
print 7 % 11;
7

put the following in order based on their precedent
1) left << >>
2)right = += = *= /= .= %= &= = ^= <<= >>=
3) non [] ()
4)left &&
6) right new
7)left XOR
8) left +  .
9)left ^
14)left OR
15) left * / %
16) non == != === !==
17)left 
18) right !~ ++  (int)(float)...@
19)left 
20)left AND
10)left ? :
11) non < <= > > = <>
12)left ,
13)left &
 6
 3
 18
 15
 8
 1
 11
 16
 13
 9
 17
 4
 19
 10
 2
 20
 7
 14
 12

what is the output of the following
$b = 2;
$z = 7 + (2 * 3) + $b *= 6  4 << 2;
print $z;
 output is : 29
 $z = (7 + (2 * 3)) + $b *= ((6 4) << 2);
 $z = 13 + $b *= 8;
 $z = 13 + 16;
 $z = 29;

$b = 3;
$z = 4 << 2 + 5 + $b *= 2 * 3;
 output is 530:
 $z = (4 << (2 + 5)) + $b *= (2 *3);
 $z = 4 << 7 + $b *= 6;
 $z = 4 * 128 + $b *= 6;$
 z = 512 + ($b *= 6);
 $z = 512 + 18;
 $z = 530;

What is the output of the following:
$b = 2;
$c = 1;
$z = 3 + 2 << 2 + $b += 3 * $c * = 1;
print $z;
 //output is 128
 //($c *= 1) needs to be evaluated so that we
 //can multiply
 $z = 3 + 2 << 2 + $b += (3 * ($c *= 1));
 $z = (3 + 2) << (2 + ($b += 3));
 $z = 5 << 7;
 $z = 5 * 128;
 $z = 128
 $z = 640;
 $z = 128;

in which direction is
~  (int) (float) (string) (array) (object) (bool) @
evaluated?
RIGHT to LEFT

in which direction is
* / % +  .
evaluated?
LEFT to RIGHT

in which direction is
<< >>
evaluated?
LEFT to RIGHT

in which direction is
& ^ 
evaluated?
LEFT to RIGHT

in which direction is
&&  ? :
evaluated?
LEFT to RIGHT

in which direction is
= += = *= /= .= %= &= = ^= <<= >>=
evaluated?
RIGHT to LEFT

in which direction is
and xor or ,
evaluated?
LEFT to RIGHT

in which direction is
< <= > >= <> == != === !==
evaluated?
They are NON Associative

