note 7236 deleted from Bitwise Operators by jimw
| From: | jimw@php.net | Date: | Thu, 11 Jan 2001 02:58:39 +0000 |
| Subject: | note 7236 deleted from Bitwise Operators by jimw | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9614@lists.php.net to get a copy of this message | ||
<pre>
>Why the shift left doen't work? >$a="0011";$b=1; echo $c = ($a << $b);
>output is 22.
</pre>
"0011" is a character string, not a string of binary digits.. String-to-int
takes the decimal value, eleven, left-shift multiplies by 2, giving 22.
That's exactly how it should work.