<?php $a = 1; $b = 3; //$c = 4; //$d = 8; //$e = 1.0; //$f = $c + $d * 2; //$g = $f % 20; //$h = $b - $a + $c + 2; //$i = $h << $c; //$j = $i * $e; //print $j; echo $a << $b; ?> PHP: can anyone tell me the function of << operator thanks
I'm not sure what mathmatical formula you are using there but this makes more sense to me: $a * 2^$b = 1 * 2^3 = 1 * 8 = 8 This function is really only used if you care about the binary representation of your number in this case $a is 1 and $a << $b = 1000 It's usually used in combination with bitwise & and | for setting flags and hash functions and stuff in cases where you want to conserve memory.