News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

WebSpeaks.in:
Learn Simple Method Chaining in PHP
February 22, 2011 @ 11:09:13

On WebSpeaks.in today there's a recent post that introduces you to something more and more applications are using - especially frameworks - method chaining in PHP OOP apps.

In this article we will learn an advanced OOPS programming concept in PHP known as Method chaining. If you have worked on PHP frameworks like Zend, Magento or CakePHP, you might have noticed a very convinient style of accessing methods of different classes. [...] This type of programming technique is known as method chaining. If you are thinking how is it possible to perform this chaining, then don't worry. Today we will learn this fancy concept.

They create a simple class, a Person, and show the difference between calling several methods on the created object versus a method chained example that calls all three, making updates to the object itself ($this). There's also a bit more complicated example with three different classes in the mix.

0 comments voice your opinion now!
method chaining tutorial object fluent


blog comments powered by Disqus

Similar Posts

Matthew Weier O'Phinney's Blog: Applying FilterIterator to Directory Iteration

Sameer Borate: Downloading Gmail attachments in PHP an update

Icemelon.com: Dynamic Images in PHP (with GD)

SitePoint PHP Blog: Using the Google Analytics API with PHP: Logging In

Brandon Savage's Blog: 5 (Good) Lessons The Government Teaches Us About Object-Oriented Programming


Community Events

Don't see your event here?
Let us know!


interview series wordpress opinion podcast extension development framework language middleware api library community voicesoftheelephpant laravel release unittest introduction conference laravel5

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework