!! is a simple trick to force the result to a boolean. The results of
$rights & $required is not a boolean, but the result of a bitmask
operation. AFAIR, this is more significant in PHP3 than PHP4. Run this
script to see what I mean. I refrained from testing with 1 and 1 since
the full effect wouldn't be revealed.
On Fri, 2002-10-11 at 18:14, Chris Weiss wrote:
What is "!!"? I only see reference to ! as NOT, and !! seems to be NOT(NOT) or
basically no change.
------------------------------------------------------------------------
$c0 $c1 $c2 $c3 $c4
"); } function test_expr($i, $j) { tr( "$i & $j", $i & $j, ($i & $j) ==
true ? 'Y' : 'N', !!($i & $j), !!($i & $j) == true ? 'Y' : 'N' ); }
tr('Expression', 'Result', 'Result == true', '!!Result', '!!Result ==
true'); test_expr(8, 31); test_expr(8, 32); ?>