php-general | 2001092
Date: 09/19/01
- Next message: Philip Olson: "Re: [PHP] hrm..loop trouble"
- Previous message: Bora Paksoy: "[PHP] Modularity--Optimizing Includes and Libs"
- In reply to: Sheridan Saint-Michel: "Re: [PHP] Weird results from Left Shift"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> <?php
> $num = 8;
> $num = decbin($num);
> echo "Number is $num<BR>";
> $num = $num << 1;
> echo "Shifted Number is $num";
> ?>
But you are using it wrong. decbin() returns a string with a binary
pattern in it. You can't shift a string. You shift numbers. If you
already know the decimal value of the number you want to shift you don't
have to do anything. I suggested bindec() because I thought you wanted to
provide a binary representation of the number for some reason.
-Rasmus
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Philip Olson: "Re: [PHP] hrm..loop trouble"
- Previous message: Bora Paksoy: "[PHP] Modularity--Optimizing Includes and Libs"
- In reply to: Sheridan Saint-Michel: "Re: [PHP] Weird results from Left Shift"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

