Skip to Content
The Art of Modern PHP 8
book

The Art of Modern PHP 8

by Joseph Edmonds
October 2021
Intermediate to advanced content levelIntermediate to advanced
420 pages
7h
English
Packt Publishing
Content preview from The Art of Modern PHP 8

Chapter 5: Object Types, Interfaces, and Unions

In this chapter, we're going to look specifically at object and class types.

Objects, like scalars, have types. Unlike scalars, though, a single object can be regarded as one of a potentially large number of types. Let's explore how this works.

We'll begin by looking at object type inheritance. Then, we are going to understand how object comparison works and the difference between identity (===) and equality (==) when it comes to objects.

Finally, in this chapter, we're going to look at the relationship between object variables and instances and look to understand the way that in PHP, objects are passed by reference by default.

The topics in this chapter are interdependent and so it is tricky to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern PHP

Modern PHP

Josh Lockhart
The PHP Workshop

The PHP Workshop

Alexandru Busuioc, David Carr, Markus Gray, Vijay Joshi, Mark McCollum, Bart McLeod, M A Hossain Tonu
PHP 8 Basics: For Programming and Web Development

PHP 8 Basics: For Programming and Web Development

Gunnard Engebreth, Satej Kumar Sahu

Publisher Resources

ISBN: 9781800566156Supplemental Content