Re: [PHP] Bitwise operation giving wrong results

2008-10-30 Thread Yeti
Usually in PHP one does not take much care about the data types, but in this case you absoloodle have to. If you use bit operators on a character then its ascii number will be taken instead (how should a number based operation work with a string?) also if you pass on $_GET params directly into ay

Re: [PHP] Bitwise operation giving wrong results

2008-10-29 Thread Chris
Ashley Sheridan wrote: On Wed, 2008-10-29 at 20:01 -0400, sean greenslade wrote: I have the following code as a test: if I set a to 15 and b to 2 in the URL like so: test.php?a=15&b=2 it outputs zero as the answer. When I run the hard-coded '&' operation (the commented out echo), it returns

Re: [PHP] Bitwise operation giving wrong results

2008-10-29 Thread Ashley Sheridan
On Wed, 2008-10-29 at 20:01 -0400, sean greenslade wrote: > I have the following code as a test: > $a = $_GET['a']; > $b = $_GET['b']; > echo $a . " & " . $b . " = "; > $out = $a & $b; > echo $out; > //echo 15 & 2; > ?> > > if I set a to 15 and b to 2 in the URL like so: > > test.php?a=15&b=2 >