php ternary operator if null code example Example 1: php shorthand if isset $var = $var ?? "default"; Example 2: php ternary shorthand $y = $x ? "true" : "false";