Stats: 3,167,242 members, 7,867,634 topics. Date: Friday, 21 June 2024 at 08:17 PM |
Nairaland Forum / Science/Technology / Webmasters / Chaining In Php (749 Views)
A Beginners Guide To Object-oriented Programming (OOP) In PHP 5+ / Ecommerce Web Application Written From Scratch In Php For Sale With Mobile View / What's The Difference Between "require Once" And "include" In Php? (2) (3) (4)
(1) (Reply)
Chaining In Php by cdeveloper(m): 2:58pm On Mar 09, 2010 |
I have been a fan of the ability to achieve chaining in Javascript as demonstrated by the famous javascript library jQuery with its philosophy of Code less Do More after grappling around this idea for a while i started thinking about the possibility of bringing it to php and somehow i have seen that even php has that ability to achieve chaining too but i am yet to explore the possible application of this concept. though one area i am looking at is web services.This is how i was able to do it. I may have to look for a more viable application of this
This is really funny but a viable idea that can be used in building api that people can use much in the same way that jQuery is used. The secret is in returning $this in the setters methods. This variable is internally an instance of the class itself and when you return it from the method it allows you to still call other methods associated with the object. This is one place that Javascript is king,and this is the concept that makes jQuery standout. with one line of code you can do more House what do you guys make of this? |
(1) (Reply)
Please Review This Site / Trudigits Webhosting - Easter Promo 50% Off / Logo Designer
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10 |