Working with objects

Getting end users to grasp the concept of data structures is no easy task. While the concept of objects having properties (for instance, a customer having a first name and a last name) is usually easy to convey, you probably would not bother end users with things like data encapsulation and object methods.

Because of this, it might be useful to hide the intricacies of data access from your end user; if a user want to access a customer's first name, they should be able to write customer.firstname, even if the actual property of the underlying object is protected, and you would usually need to call a getFirstname() method to read this property. Since getter functions typically follow certain naming patterns, our parser can automatically ...

Get PHP 7 Programming Blueprints 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.