Output:
- <?php
- if('0001' == '1'){
- echo 'when == test, 0001 and 1 are equal';
- }
- if('0001' === '1'){
- echo 'when === test, 0001 and 1 are equal';
- }
- ?>
when == test, 0001 and 1 are equal
Output:
- <?php
- if(1 == true){
- echo 'when == test, 1 and true are equal';
- }
- if(1 === true){
- echo 'when === test, 1 and true are equal';
- }
- ?>
when == test, 1 and true are equal
Note: any number equals to true, 0 equals to false.
- <?php
- if('any string' == true){
- echo 'when == test, any string and true are equal';
- }
- if('any string' === true){
- echo 'when === test, any string and true are equal';
- }
- ?>
Output:
when == test, any string and true are equal
No comments:
Post a Comment