Operators - I am a little stuck

I am brand new to PHP and am learning on a short course alongside others.
I have been given the following two echo statements to try.
Underneath each statement I have written an explanation to myself for how it works. However, I am not getting the results I expected for the first one. Can anyone help explain where I may be going wrong? Thank you.

echo ($w === 7 && $y == true) . "<br/>";
        //echo if w is identical to 7 and y is true
        //w is 7 and y is true
        //w is identical to 7 and y is identical to true
        //RESULT:
        // 
*(this is returning as blank/false and I was expecting it to be true)*
        
**echo ($w == 8 || $z == false) . "<br/>";**
        //echo if w is identical to 8 or z is false
        //w is 7 and z is false
        ////w is not identical to 8 but z is identical to false
        //RESULT:
        // 1

Need the values of your test variables.

$w = '7';
echo ($w === 7) ? 'true' : 'false'; // false
echo ($w == 7)  ? 'true' : 'false'; // true

$y will always be true if it has a value that is not false.

$t;
echo ($t == true) ? 'true' : 'false'; // false
$t = false;
echo ($t == true) ? 'true' : 'false'; // false

Sorry, the formatting on my post came out really badly.
Here’s a screenshot:

27

The values are:
$w 7
$x 5
$y true
$z false

Sponsor our Newsletter | Privacy Policy | Terms of Service