on-internet
← Community

PHP's short-ternary ("Elvis") operator vs null coalescing operator

Stack Overflow ·

What are the differences between the ternary operator shorthand (?:) and null coalescing operator (??) in PHP? When do they behave differently and when in the same way (if that even happens)? $a ?: $b vs. $a ?? $b

Comments

Sign in or sign up to comment and upvote.

No comments yet.