After seeing another question just started, I wanted to ask as to how something is actually achieved.
When I use some frameworks they do this like
$object->select('something') ->from('table') ->where( new Object_Evaluate('x') ) ->limit(1) ->order('x');
How do you actually do this kinds of chains?
The basic idea is that each method (that you want to be able to chain) of the class has to return
$this -- which makes possible to call other methods of that same class on the returned
And, of course, each method has access to the properties of the current instance of the class -- which means each method can "add some information" to the current instance.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki