|
~ is to invert all the bits in PHP and + 1 is to make it a negative number. Remember in CS101 that binary number can be converted to represent a negative number by invert all the bits and +1?
abs() is to make sure it is not a negative number and force it to be a positive number even though it is a negative number. Inverting a negative number will only make it worse.
No comments:
Post a Comment