Re: php + mysql: binary arrays

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

 



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($groups_as_string);
> echo $groups_as_string;
> 
> Note:  As of PHP 4.3.0, the glue parameter of implode() is optional
> and defaults to the empty string(''). This is not the preferred usage
> of implode(). We recommend to always use two parameters for
> compatibility with older versions.
> 
> I know implode is binary-safe, not sure about preg_split()
> 
> you COULD also use spliti() instead of preg_split()
> http://us4.php.net/manual/en/function.spliti.php
> 
> Colin
> 
> On Tue, 29 Mar 2005 20:35:02 +1000, Robert S <robert_s@xxxxxxxxxxxxxx> wrote:
> > I am writing a contact manager in php/mysql.  I'd like to use a binary array
> > as an efficient way to store information for groups that each contact
> > belongs to eg:
> >
> > Field: 'group': 001010 means that the contact belongs to the second and
> > fourth group.
> >
> > If the array is of type Byte, it should be able to store information about
> > 255 groups.
> >
> > Is php/mysql able to handle this?  My specific questions are:
> >
> > What functions set/clear a bit in an array in php?
> > How do you query whether a bit is set in mysql?
> >
> > I hope I've made this clear enough to be followed - I'm not a pro!
> >
> > --
> > 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