Modify a bit at a given position | Returns modified n . ; Driver code
< ? php function modifyBit ( $ n , $ p , $ b ) { $ mask = 1 << $ p ; return ( $ n & ~ $ mask ) | ( ( $ b << $ p ) & $ mask ) ; } echo modifyBit ( 6 , 2 , 0 ) , " STRNEWLINE " ; echo modifyBit ( 6 , 5 , 1 ) , " STRNEWLINE " ; ? >