On Wed, 2008-10-29 at 20:01 -0400, sean greenslade wrote:
> 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.

In PHP a boolean true also equates to 1. You are using the & operator
though, instead of the && which I think you're looking for. They both do
different things. Sorry, it's late and I've been befriending mr Jack
Daniels a little tonight, so forgive me if my answer is as close to what
you were looking for as is 42 (life the universe and everything) to The
Question.


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to