Operator precedence. What you got was: (6 < 8 ? $ans = "true" : $ans) = "false";
In reply to Re: if statement confusion by Anonymous Monk in thread if statement confusion by Anonymous Monk