PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 4 ■ ADVANCED FEATURES


shoes: processing
count: 6


coffee: processing
count: 12


high price reached: 12


This demonstrates that the callback is keeping track of $count between invocations. Both $count
and $amt remain associated with the function because they were present to the context of its declaration,
and because they were specified in its use clause.


Summary


In this chapter, we came to grips with PHP’s advanced object-oriented features. Some of these will
become familiar as you work through the book. In particular, I will return frequently to abstract classes,
exceptions, and static methods.
In the next chapter, I take a step back from built-in object features and look at classes and functions
designed to help you work with objects.

Free download pdf