I'm trying to convert parts of a python script into php. I know most of it, but I've run into something to do with bitshifting (i think?) which I don't have much experience in even in PHP! Can somebody translate this python function into php please?
def setBit(value, position, on):
if on:
mask = 1 << position
return (value | mask)
else:
mask = ~(1 << position)
return (value & mask)