What is this code / What does it do?
So I was browsing through some PHP references and this came up:

    <?php
    $x = "hello world";
    echo $x = ($x) ? true : false;
    ?>

I have never actually come across this before :S
I ran this on my local machine and it returned true. 

How / Why does this code output 1, and what exactly is this?

My guess is that it checks if $x is set, and if it is, it returns whatever is on the left of the colon. 

Thanks!
What is this code / What does it do?
===

So I was browsing through some PHP references and this came up:

    <?php
    $x = "hello world";
    echo $x = ($x) ? true : false;
    ?>

I have never actually come across this before :S
I ran this on my local machine and it returned true. 

How / Why does this code output 1, and what exactly is this?

My guess is that it checks if $x is set, and if it is, it returns whatever is on the left of the colon. 

Thanks!