Re: call_user_method object not by reference

From: Date: Thu, 19 Oct 2000 12:09:21 +0000
Subject: Re: call_user_method object not by reference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21141@lists.php.net to get a copy of this message
On Sat, Oct 14, 2000 at 01:38:49PM -0600, Mike Heath wrote: > The PHP 4 function call_user_method does not use a reference to the object > (or am I doing something wrong here.) > > <?php > class foo { > var $num; > function foo() { > $this->num = 0; > } > function addcount() { > $this->num++; > echo "<br>".$this->num; > } > } > > $joe = new foo(); > call_user_method("addcount", $joe); > call_user_method("addcount", $joe); > call_user_method("addcount", $joe); > ?> > You would think this would echo "123" but instead it outputs "111". Should > call_user_method be using references instead of copying the object? > > Any comments and/or help would be appreciated. that doesn't make any sense to me, and it should be fixed - please submit a bug-report (if it's not already reported in teh bug-db) thanx, tc > > Thanks, > > Mike > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#21141) next »