in reply to Could someone please explain this to me in newbie terms :)

First you have to understand that when you ask if ($y) { ... }

and $y is a number, than this is short for if ($y != 0) { ... }.

The ? : construct is like a short if which returns a value: if the condition is true, the value of the expression between ? and : is evaluated, if not, the expression after the : is evaluated (and returned).