Bug #13532 Updated: bit_count()
| From: | rasmus@php.net | Date: | Wed, 03 Oct 2001 18:16:49 +0000 |
| Subject: | Bug #13532 Updated: bit_count() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67227@lists.php.net to get a copy of this message | ||
ID: 13532
Updated by: rasmus
Reported By: russlndr@online.no
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] derick@php.net
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] russlndr@online.no
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