Clarification on chaining
Clarification on chaining
marthaj6289
Posts: 3Questions: 2Answers: 0
I am somewhat confused about the statements in the documentation concerning chaining with PHP and Editor..
I understand that chaining is not available in PHP v5.3 , but chaining is available with the Editor.
Does this mean if you are using PHP v5.3 with the Editor, you can do chaining?
This discussion has been closed.
Answers
in PHP 5.4+ you can chain off a constructor - so for example you can do:
In 5.3 that would give an error as you can't chain from the constructor in 5.3. Instead, the Editor libraries provide a factory method which you can chain off:
Personally I massively prefer the style of the first example, but PHP5.3 is still used on a lot of servers, so I use that style for the documentation so try and avoid confusion (I guess I haven't somewhere though...)!
You can chain off methods in 5.3 - it isn't that chaining isn't possible at all - its just that you can't chain from constructors.
Regards,
Allan