Viewing posts tagged OOP

Dynamically Access PHP Object Properties with $this

Sometimes we need to be able to retrieve the value of a property on an object, but we don't know the name of that property. Instead, we need to dynamically calculate the property name, and then access the value. For example: $row->{$my_property};. This post looks at how the Views module uses this technique and allows for a huge amount of flexibility.

Release Day: Object-Oriented PHP Part 2

We've recently switched from weekly releases to working towards releasing an entire series all on the same day. The Object-Oriented PHP Part 2 series is the first one we're doing with this. You get access to the complete series today! This second part of three on object-oriented PHP, provided by KnpUniversity, continues on from our Introduction to Object-Oriented PHP series.