PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Lorna Mitchell: A Little More OOP in PHP

Note: This article was originally published at PHPDeveloper on 2 November 2012.
PHPDeveloper

Lorna Mitchell has republished a previous article about OOP (following this entry) introducing you to some of the core object-oriented programming concepts in PHP.

This time around we'll look at some more advanced concepts and some more practical examples of building code, covering use of constructors and how to add access modifiers in to control how calling code can operate on your objects. We'll also show off how to create static methods and properties and, perhaps more importantly, illustrate applications of these features.

She talks about initializing objects with constructors, working with "statics" and using instanceof to determine the object type. Sample code is included to help illustrate the concepts.