Toggling k | Php program to toggle k - th bit of n ; Driver code
< ? php function toggleKthBit ( $ n , $ k ) { return ( $ n ^ ( 1 << ( $ k - 1 ) ) ) ; } $ n = 5 ; $ k = 1 ; echo toggleKthBit ( $ n , $ k ) ; ? >