Re: A serious bug? "or" operator gives out diffferent results depending on order of operands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> $a = $b ^^  $c

You sure? It didn't work for me, and it isn't listed in the PHP manual.

I used:
<?php
        var_dump(1 ^^ 0);
        var_dump(0 ^^ 1);
        var_dump(0 ^^ 0);
        var_dump(1 ^^ 1);
?>

to test it and got a syntax error. 

I suppose you could use the bitwise one as a bit of a hack, so long as
you 'boolean-ised' both arguments first.
eg $a = (!!$b) ^ (!!$c);   // or even $a = !$b ^ !$c; since xor
depends exclusively on both sides being different to each other.


> > Generally however there is no need to parentisize everything to the
> > right of the assignment operator(=), since besides 'and', 'or', 'xor',
> > and the comma operator. The only time I see the need to parentisize
> > everything to the right is when using the xor operator, since there is
> > no equivlent above the = operator.
> 
> $a = $b ^^ $c;
> 
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
> 
> http://www.smempire.org
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux