Forum Moderators: coopster

Message Too Old, No Replies

chaining method compatibility problem ?

         

PHPycho

5:16 am on Jan 3, 2009 (gmt 0)

10+ Year Member



Hello forums !
I would like to know how to make the chaining methods compatible in both php4 and php5.
As we know chaining methods works only in php5.
Is there any hacks to make it work in php4 too.
My Chaining method working in PHP5 looks like:
MyClass::getObject()->getObj('obj1')->getObj('obj2')->someMethod();

Any Help/suggestions would be highly appreciated.

eelixduppy

2:54 pm on Jan 3, 2009 (gmt 0)



In order to achieve this, you need to be able to return an object, which only PHP 5 supports as part of the many changes they made to OOP between the two versions. I do not think you can emulate this functionality. If you are serious about using OOP on your site, you should definitely stick with PHP 5 anyways.