Bitwise operation giving wrong results

From: Date: Thu, 30 Oct 2008 00:01:58 +0000
Subject: Bitwise operation giving wrong results
Groups: php.general 
Request: Send a blank email to php-general+get-282592@lists.php.net to get a copy of this message
I have the following code as a test: <?php $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 it outputs zero as the answer. When I run the hard-coded '&' operation (the commented out echo), it returns 2. I'm stumped. -- --Zootboy

« previous php.general (#282592) next »