Re: [PHP] PHP 4.3.11, call_user_func and instances of classes

2006-04-27 Thread Richard Lynch
On Wed, April 26, 2006 6:46 pm, David Otton wrote: > class Test { > var $x; > function Test () > { > global $addition, $subtraction; > $this->x = 0; > $addition = array ($this, 'AddOne'); > $subtraction = array ($this, 'Sub

Re: [PHP] PHP 4.3.11, call_user_func and instances of classes

2006-04-26 Thread Martin Alterisio
The problem is not what it seems. PHP4 assigns object by copy, not by reference. This is causing the call_user_func() to use a copy of the object instead of the original object. So, all modifications are lost once the call is done. One solution to this is to assign objects by reference: $addition

[PHP] PHP 4.3.11, call_user_func and instances of classes

2006-04-26 Thread David Otton
A bit of an oddity, this. There's some example code attached which illustrates my problem. I am attempting to call a method of an instance of an class from outside that instance, using call_user_func(). What's happening is that my attempt to call array ($this, 'AddOne') is silently being rewrit