© Matt Zandstra 2016

MATT ZANDSTRA, PHP Objects, Patterns, and Practice, 10.1007/978-1-4842-1996-6_3

3. Object Basics

Matt Zandstra

(1)Liverpool, Merseyside, UK

Objects and classes lie at the heart of this book and, since the introduction of PHP 5 over a decade ago, they have lain at the heart of PHP, too. In this chapter, I lay down the groundwork for more in-depth coverage of objects and design by examining PHP’s core object-oriented features. If you are new to object-oriented programming, you should read this chapter carefully.

This chapter will cover the following topics:

  • Classes and objects: Declaring classes and instantiating objects

  • Constructor methods: Automating the setup of your objects

  • Primitive and class types: Why type matters

  • Inheritance ...

Get PHP Objects, Patterns, and Practice, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.