'Checking if variable exist and if it has a certain value in one line [duplicate]

I have always thought that if I want to check if a variable exists and has a certain value I have to use two if conditions:

if(isset($x)){
    if($x->age==5){}
}

But I realized its also possible to do it in one line this way:

if(isset($x) && ($x->age==5)){}

Can someone tell me why the second variation will not result in an error if $x is null. Given that $x is null and doesn't have the property age? Would it be trying to access a property that doesn't exist?

$x=null;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source