Chapter 3Objects and OOP
In this book, we'll be using the Object Oriented Programming (OOP) paradigm. With OOP, we can create "objects" that combine data and the functions that operate on that data together. Because objects in OOP collect data and the functions that work on them in one place, we keep our code organized and can better manage complexity as our application grows.
The code that we write to define an object is called a class. One way to better understand the relationship between classes and objects is to think of a home builder. The builder—PHP for our purposes—follows a blueprint (a class) to build a house (an object).
Just as a builder can construct several houses using the same blueprint, so too can PHP create multiple instances ...
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.
Read now
Unlock full access