How can I create something like this in PHP4 ?
$obj->item->func()->item2
func returns also an obj.
When I use :
$var = $obj->item->func();
$var->item2
it works but how can I handle the code like the first one? In PHP5 its possible but I dont know how to do it in 4.
Thanks.
Object functions
Moderator: General Moderators
Re: Object functions
Why dont you use php5?
Re: Object functions
because my server doesnt support php5 and PLEASE dont give answers that is not related with the question. I asked if its possible or not. If you want more details, I wrote a XML parser class and I need that type of content handling.
Re: Object functions
You can't. this:
is impossible in php4 and will lead to parse error.
On the other hand, construction like this is certainly valid:
Code: Select all
func()->member
On the other hand, construction like this is certainly valid:
Code: Select all
$html->body->div[4]->getContent()
Re: Object functions
Ok thank you.
Re: Object functions
sometime is good to ask to understand the environment you are in. Some people may not even know that they can upgrade. I ask to provide a better answer. But dont worry. I will know from you name that I should not even bother to help.