// below is assign if null $final_output = $check_null ?: $default_value; // assign if not null $final_output = !($check_null) ?: $default_value; `Edit` ?: is tenary operator a.k.a one-line if expression syntax: <if expression null> ?: <do this>