Need Assistance?

support@tutorialshub.in

Variables, Data Types & Operators

Comparison (== vs ===) & Null Coalescing (??)

ADVERTISEMENT
PHP Free Lesson
5 min read
ADVERTISEMENT

Always prefer strict comparison (===) over loose comparison (==). Loose == compares values after converting types (so 0 == "abc" used to be true in older PHP!), whereas === checks that both value and type match.

Null Coalescing Operator (??)

The ?? operator returns the left side if it exists and is not null; otherwise it falls back to the right side—saving you from writing isset() checks everywhere.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you