PHP5 Method Chaining


Introduction
In this article, I’ll be talking about a useful new feature introduced in PHP5 as part of the OOP improvements over PHP4. This feature is called Method Chaining and enables us to do pretty cool things like:

PHP Code:
$object->method_a()->method_b()->method_c();

So really what’s this all about? Well, one change (of many) between PHP4 and PHP5 is that now methods can return objects. That’s only a small change but allows for a new way of thinking about how you handle objects and their methods.

Tiếp tục đọc