Re: Bug #9090 Updated: call_user_method() duplicates object

From: Date: Mon, 22 Oct 2001 10:12:37 +0000
Subject: Re: Bug #9090 Updated: call_user_method() duplicates object
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-68696@lists.php.net to get a copy of this message
Have you tried passing by reference ? call_user_method('increase', &$foo); - Markus On Sun, Oct 21, 2001 at 11:12:00PM -0000, sniper@php.net wrote : > [2001-02-03 17:21:00] cazzell@eng.usf.edu > > First some sample code: > > > class foo { > var $bar = 0; > function increase () { > $this->bar++; > } > } > > $foo = new foo; > > print "Bar: " . $foo->bar . "\n"; > call_user_method('increase', $foo); > print "Bar: " . $foo->bar . "\n"; > > $foo->increase(); > print "Bar: " . $foo->bar . "\n"; > > > This will output: > > Bar: 0 > Bar: 0 > Bar: 1 > > It appears that call_user_method is working on a copy of the object rather than the object > itself. >

« previous php.dev (#68696) next »