Re: [PHP] How to check flags?

2002-04-21 Thread Miguel Cruz

On Sun, 21 Apr 2002, albertonews wrote:
 I don't know how to say this in english, so try to discover:
 
 2 = Married
 4 = Single
 8 = With Children
 16 = Without Children
 32 = Man
 64 = Woman
 
 then we add the values we want
 74 = Woman Married With Children

Look up the operators  and |

If you can give a more concrete example then I can give you a little code 
snippet.

miguel


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




Re: [PHP] How to check flags?

2002-04-21 Thread albertonews

I want this:

2 Bloco
4 Sessão
8 Sistema

only this three

but I don't want nothing like this:
If ($abc == 10) {
}

I want something that really explode the number

21/04/2002 14:30:37, Miguel Cruz [EMAIL PROTECTED] wrote:

On Sun, 21 Apr 2002, albertonews wrote:
 I don't know how to say this in english, so try to discover:

 2 = Married
 4 = Single
 8 = With Children
 16 = Without Children
 32 = Man
 64 = Woman

 then we add the values we want
 74 = Woman Married With Children

Look up the operators  and |

If you can give a more concrete example then I can give you a little code
snippet.

miguel







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




Re: [PHP] How to check flags?

2002-04-21 Thread Miguel Cruz


  if ($abc  2) print 'Bloco';
  if ($abc  4) print 'Sessão';
  if ($abc  8) print 'Sistema';

Or...

  // take an integer and turn it into an indexed array. For each bit
  // b that is set, subscript b of the array will be set to 1. For 
  // instance, bitsplit(5) would return an array with subscripts 0
  // and 2 set to 1.
  function bitsplit($bits)
  {
$r = array();
$i = 0;
while ($bits)
{
  if ($bits  1)
$r[$i] = 1;
  $i++;
  $bits = 1;
}
return $r;
  }

miguel

On Sun, 21 Apr 2002, albertonews wrote:
 I want this:
 
 2 Bloco
 4 Sessão
 8 Sistema
 
 only this three
 
 but I don't want nothing like this:
 If ($abc == 10) {
 }
 
 I want something that really explode the number
 
 21/04/2002 14:30:37, Miguel Cruz [EMAIL PROTECTED] wrote:
 
 On Sun, 21 Apr 2002, albertonews wrote:
  I don't know how to say this in english, so try to discover:
 
  2 = Married
  4 = Single
  8 = With Children
  16 = Without Children
  32 = Man
  64 = Woman
 
  then we add the values we want
  74 = Woman Married With Children
 
 Look up the operators  and |
 
 If you can give a more concrete example then I can give you a little code
 snippet.
 
 miguel
 
 
 
 
 
 
 
 --
 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




Re: [PHP] How to check flags?

2002-04-21 Thread Rasmus Lerdorf

if($abc  2) echo 2 Blocobr\n;
if($abc  4) echo 4 Sessaobr\n;
if($abc  8) echo 8 Sistemabr\n;

-Rasmus

On Sun, 21 Apr 2002, albertonews wrote:

 I want this:

 2 Bloco
 4 Sessão
 8 Sistema

 only this three

 but I don't want nothing like this:
 If ($abc == 10) {
 }

 I want something that really explode the number

 21/04/2002 14:30:37, Miguel Cruz [EMAIL PROTECTED] wrote:

 On Sun, 21 Apr 2002, albertonews wrote:
  I don't know how to say this in english, so try to discover:
 
  2 = Married
  4 = Single
  8 = With Children
  16 = Without Children
  32 = Man
  64 = Woman
 
  then we add the values we want
  74 = Woman Married With Children
 
 Look up the operators  and |
 
 If you can give a more concrete example then I can give you a little code
 snippet.
 
 miguel
 
 
 




 --
 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