Double not (!!) operator in PHP Last Updated : 05 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The "NOT NOT" operator or Double not(!!) operator in PHP simply returns the truth value of the variable or expression. To explain in very simple terms, the first not operator(!) negates the expression. The second not operator(!) again negates the expression resulting the true value which was present before. The (!!) operator returns as that Boolean function. If use !! to an expression the true value will be true and false value would be false. That is no change in the Boolean value. By using this double not(!!) operator it can increase the code readability and also ensure the truth and false values to be strictly Boolean data types. Example 1: php <?php // Declare a variable // and initialize it $a = 1; // Use double not operator $a = !!$a; // Display the value // of variable a. echo $a; ?> Difference between logical NOT(!) operator and Double NOT(!!) operator in PHP: The Not operator is the mathematically complements or negates the Boolean value of the concerned data. For example a Boolean value of $a = True, then the NOT operator imposed on it !$a would be False. This is about logical NOT or Negation operator. Where as the Double NOT (!!) operator returns only the Boolean cast or the truth value. That is !!$a is always TRUE. Here is an another example based on double NOT operator. Example 2: php <?php // PHP program to illustrate // Double NOT operator // Declare a variable and // initialize it $t = 10; // Check condition if ($t !== 10) echo "This is NOT operator!"; elseif (!!$t) echo "This is Double NOT operator!"; else echo "Finish!"; ?> The above code strictly save the Boolean data type and returns the truth value of the variable. Comment More infoAdvertise with us Next Article Scope Resolution operator in PHP M MerlynShelley Follow Improve Article Tags : Technical Scripter Web Technologies PHP PHP Programs Technical Scripter 2018 PHP-Operators +2 More Similar Reads How to use Modulo Operator in PHP ? The modulo operator in PHP is represented by the percentage symbol %. It calculates the remainder of one number divided by another. The basic syntax for the modulo operator is- Syntax: $result = $num1 % $num2;Here, $num1 is the dividend, and $num2 is the divisor. The result will be the remainder aft 1 min read Ternary operator vs Null coalescing operator in PHP Ternary Operator Ternary operator is the conditional operator which helps to cut the number of lines in the coding while performing comparisons and conditionals. It is an alternative method of using if else and nested if else statements. The order of execution is from left to right. It is absolutely 3 min read How to Convert Int Number to Double Number in PHP ? In PHP, working with numeric data types is a common task, and sometimes you might need to convert an integer (int) to a double (float). In this article, we will explore various approaches to achieve this conversion in PHP, covering different methods based on the PHP version and use cases. Table of C 2 min read Scope Resolution operator in PHP The scope resolution operator also known as Paamayim Nekudotayim or more commonly known as the double colon is a token that allows access to static, constant, and overridden properties or methods of a class. It is used to refer to blocks or codes in context to classes, objects, etc. An identifier is 2 min read PHP | Ternary Operator If-else and Switch cases are used to evaluate conditions and decide the flow of a program. The ternary operator is a shortcut operator used for shortening the conditional statements. ternary operator: The ternary operator (?:) is a conditional operator used to perform a simple comparison or check on 3 min read PHP | Ternary Operator If-else and Switch cases are used to evaluate conditions and decide the flow of a program. The ternary operator is a shortcut operator used for shortening the conditional statements. ternary operator: The ternary operator (?:) is a conditional operator used to perform a simple comparison or check on 3 min read Like