PHP 7 Programming Blueprints
上QQ阅读APP看书,第一时间看更新

Summary

As you can see, we have a lot of use cases for the null coalesce.

We learned how to make a simple user profile system, and how to use PHP 7's null coalesce feature when fetching data from the database, which returns null if there are no records. We also learned that the null coalesce operator is similar to a ternary operator, except this returns null by default if there is no data.

In the next chapter, we'll have more use cases for other PHP 7 features, especially when creating the database abstraction layer for use in our projects.