Re: Weird results from Left Shift
| From: | Rasmus Lerdorf | Date: | Wed, 19 Sep 2001 20:51:22 +0000 |
| Subject: | Re: Weird results from Left Shift | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67896@lists.php.net to get a copy of this message | ||
> Okay, from the manual I have
> $a << $b - Shift the bits of $a $b steps to the left
>
> When I run the code
>
> <?php
> $num = "0001000";
> echo "Number is $num<BR>";
> $num = $num << 1;
> echo "Shifted Number is $num";
> ?>
>
> I get the output
>
> Number is 0001000
> Shifted Number is 2000
>
> What am I missing?!?
Use: $num = bindec("0001000");
-Rasmus