ID: 13532
Updated by: rasmus
Reported By: [EMAIL PROTECTED]
Status: Closed
Bug Type: Feature/Change Request
Operating System: All
PHP Version: 4.0.6
New Comment:

I think he may have meant the number of bits set in a bit field.  Something like this 
should cover it:

function bit_count($num) {
    return strlen(str_replace('0','',decbin($num)));
}

Previous Comments:
------------------------------------------------------------------------

[2001-10-03 13:12:37] [EMAIL PROTECTED]

function bit_count($var) {
    return strlen($var) * 8;
}

It's very easy to do in PHP itself, thus I see no use for this function.

Derick

------------------------------------------------------------------------

[2001-10-03 13:10:44] [EMAIL PROTECTED]

Suggestion:
Add a function who can count number of bits who are set in a variable.

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13532&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to