Re: [PHP] php + mysql: binary arrays

2005-03-29 Thread Colin Ross
oops.. how bout if i send it to the group too... > http://us4.php.net/manual/en/function.preg-split.php > > example for you: > > $groups = '0101000100101010001110010100111'; > $groups_array = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); > print_r($groups_array); > $groups_as_string = implode

RE: [PHP] php + mysql: binary arrays

2005-03-29 Thread YaronKh
Hi First of all you can use the Bitwise Operators to set/clear a bit Let say $a is '00100' meaning group 2 is set and you want to set group 4 then write: $a = $a | (pow(2 ,4)); //using OR Operator Now $a is '10100' Let say that you want to unset group 2: $a = $a ^ (pow(2,2)); //using XOR Operator