unknown os platform
Free Beginner PHP Tutorials - Triple equals operators | Whats-online.info
whats-online-info

Free Beginner PHP Tutorials - Triple equals operators


Free
2016:08:26 / Science and Tutorials

Learn how to use Triple equal operator that is ' === ' in PHP See example:-





Php triple equals operator



Php triple equals operator Is a three equals operator that compares two values and returns true if the two values are equal and are of the same data type. 

Example 1

<?php $x=100; $y="100"; var_dump($x === $y); ?>
 
Output: bool(false); 

Returns false because the values are similar, but not identical. $x is an integer value while $y is a string value.

Triple equals operator returns a boolean true if both the operands are equal and are of the same data type.

Example

String data type


<?php $x="100"; $y="100"; var_dump($x === $y); ?>

 Output: bool(true); 

Returns true because the values are equal and identical. $x and $y are both string values and are equal.
The below expressions returns true and obey the PHP triple equals operator usage.

<?php if(double === double) return true; if(integer === integer) return true; if(string === string) return true; ?>












You may also like:


Leave a comment












Subscribe to get replies direct to your mailbox

Submit comment