chaining method compatibility problem ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

chaining method compatibility problem ??

Post by PHPycho »

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:

Code: Select all

MyClass::getObject()->getObj('obj1')->getObj('obj2')->someMethod();
Any Help/suggestions would be highly appreciated.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: chaining method compatibility problem ??

Post by Chris Corbyn »

Chaining doesn't work in PHP4 and there are no workarounds ;) You'll just have to do it the long way around unfortunately (or stop supporting PHP4 like Zend have).
Post Reply