Re: [PHP] Weird results from Left Shift

2001-09-19 Thread Rasmus Lerdorf
> $num = 8; > $num = decbin($num); > echo "Number is $num"; > $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 n

Re: [PHP] Weird results from Left Shift

2001-09-19 Thread Sheridan Saint-Michel
age - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Sheridan Saint-Michel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, September 19, 2001 3:51 PM Subject: Re: [PHP] Weird results from Left Shift > > Okay, from the manual I have >

Re: [PHP] Weird results from Left Shift

2001-09-19 Thread Rasmus Lerdorf
> Okay, from the manual I have > $a << $b - Shift the bits of $a $b steps to the left > > When I run the code > > $num = "0001000"; > echo "Number is $num"; > $num = $num << 1; > echo "Shifted Number is $num"; > ?> > > I get the output > > Number is 0001000 > Shifted Number is 2000 > > What am I

RE: [PHP] Weird results from Left Shift

2001-09-19 Thread Eric O'Connell
> Okay, from the manual I have > $a << $b - Shift the bits of $a $b steps to the left > > When I run the code > > $num = "0001000"; > echo "Number is $num"; > $num = $num << 1; > echo "Shifted Number is $num"; > ?> > > I get the output > > Number is 0001000 > Shifted Number is 2000 > > What