Check whether K | PHP program to check if k - th bit of a given number is set or not using right shift operator . ; Driver code
< ? php function isKthBitSet ( $ n , $ k ) { if ( ( $ n >> ( $ k - 1 ) ) & 1 ) echo " SET " ; else echo " NOT ▁ SET " ; } $ n = 5 ; $ k = 1 ; isKthBitSet ( $ n , $ k ) ; ? >