Count total bits in a number | PHP program to find total bit in given number ; log function in base 2 take only integer part ; Driver Code
< ? php function countBits ( $ number ) { return ( int ) ( log ( $ number ) / log ( 2 ) ) + 1 ; } $ num = 65 ; echo ( countBits ( $ num ) ) ; ? >