Chaining in PHP (Like jQuery)

This may be well known, but I found it interesting while reading this stackoverflow question. I may have read the OP incorrectly in retrospect.

Anyways, in order to chain methods like what is done in JavaScript’s jQuery each method in the class definition must return an instance of the class:

It can then be called in this fashion:

Which will output something like:

I’m sure some abstract classes and wrappers could be designed to easily integrate this as a flexible library. It would do the same thing for PHP as jQuery did for JavaScript.