Nesting null coalescing operator

47 views Asked by At
<?php
        
        $foo = null;
        $bar = null;
        $baz = 1;
        $qux = 2;
        
        echo $foo ?? $bar ?? $baz ?? $qux; // outputs 1
?>

Hello everyone!

Here I'm using Nesting null coalescing operator. but why I am getting output 1? can you please explain this behavior?

Thank you!

0

There are 0 answers