Quote:
Originally Posted by KliPPy
It's not a single operator, but negation operator "!" being done twice. You would want to use that when you want to coerce a cell into a boolean, following the rule that 0 = false, anything else = true.
Code:
!!(0) == false
!!(1) == true
!!(42) == true
!!(-69) == true
This way you are making sure that your boolean is either "true" or "false" and not bool:420 for example. That's good because some people prefer to do "if(variable == true)" instead of "if(variable)", which won't give correct results if you don't "normalize" your boolean value.
|
Pardon me.
Based on your explanation, what I understand is;
PHP Code:
new i_Variable = 0
if( !!i_Variable )
That will not let the 'if' statement functional, right? So if we do;
PHP Code:
new i_Variable = 1
if( !!i_Variable )
Then, this will make the 'if' statement functional. Well, it is not all time should be storing '1' even other than '1' is still available, as long as the variable did not store '0'.
Correct me if I am wrong.
Thank you.