
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
Double not (!!) operator in PHP
In the Double not operator (!!), the first not i.e. ! is used to negate a value, whereas the second not i.e.! again negates. To implement Double not operator in PHP, the code is as follows−
Example
<?php $str = "0.1"; echo "Value = $str"; $res = !!$str; echo "
Double Negated Value = $res"; ?>
Output
This will produce the following output−
Value = 0.1 Double Negated Value = 1
Example
Let us now see another example −
<?php $str = "100.56"; echo "String = $str"; $num = floatval($str); echo "
Number (Converted from String) = $num"; $res = !!$num; echo "
Double Negated Value = $res"; ?>
Output
This will produce the following output−
String = 100.56 Number (Converted from String) = 100.56 Double Negated Value = 1
- Related Articles
- What does double question mark (??) operator mean in PHP ?
- What is double address operator(&&) in C++?
- Apply Ternary operator on double value in Java
- What is the "double tilde" (~~) operator in JavaScript?
- PHP Execution Operator
- PHP Operator Precedence
- What is the Kotlin double-bang (!!) operator?
- Nullsafe Operator in PHP 8
- What does the Double Star operator mean in Python?
- Is the !! (not not) operator in JavaScript equivalent to reverse process of not operator?
- PHP Scope Resolution Operator (::)
- PHP Error Control Operator
- Difference between !== and ==! operator in PHP
- Is there a PHP function that only adds slashes to double quotes NOT single quotes
- What is the !! (not not) operator in JavaScript?

Advertisements