This shows all integers from 1 to 10 that have the 2 least significant 
bits set:

<?php

   for ($i = 1; $i <= 10; $i++) 
   {
      if ($i & 3)
      {
         echo($i . "\n");
      }
   }
?>

bvr.

Charlie Killian wrote:

>How can I test if a number only has on bit set?
>
>So testing different numbers will return TRUE or FALSE:
>
>testing 00010000 would return TRUE.
>testing 00000011 would return FALSE.
>
>TIA
>
>Charlie
>
>
>
>
>



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

Reply via email to