Possible Duplicate:
What does this ~ operator mean here?
Bit not operation in PHP(or any other language probably)
Can someone explain me the ~
operator in PHP? I know it's a NOT-operator, but why does PHP convert following statement to the negative value of the variable minus one?
$a = 1; echo ~$a // echo -2
$a = 2; echo ~$a // echo -3
$a = 3; echo ~$a // echo -4