On Tue, 2006-06-13 at 06:22, Jochem Maas wrote: > > My brain needs a crutch when trying doing this kind of thing > (normally I only write hex number literally when dealing with bitwise stuff - > the conversion stuff still makes my head spin) - this is what this table is for: > > 128 64 32 16 8 4 2 1 > 1 0 1 1 0 1 0 1 > 0 1 0 1 1 1 0 0 > 0 0 0 0 1 1 1 1 > > and then I did this - hopefully it shows what you can/have to do: > > <?php > > // set some values > $oldval = 128 + 32 + 16 + 4 + 1; // 10110101 > $update = 64 + 16 + 8 + 4; // 01011100 > $mask = 8 + 4 + 2 + 1; // 00001111 You could just do the following: $oldval = bindec( '10110101' ); $update = bindec( '01011100' ); $mask = bindec( '00001111' ); Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php