|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-06-29 09:02 UTC] bachi2 at insign dot ch
I've run into this already a year ago and now again: The call_user_method() function does not correctly change the properties of the object it's called upon - OR (what I assume) it copies the called object. Just try the code below - the counter remains on 4, not 6 as supposed.
(I also tried to pass the obj. by reference: call_user_method ("increase", &$t); - it didn't help)
class test
{
var $a=0;
function increase()
{
$this->a++;
echo "a is now: ".$this->a."\n
";
}
}
$t = new test();
echo "Direct calls:\n
";
$t->increase();
$t->increase();
$t->increase();
echo "
\n\nIndirect calls:\n
";
call_user_method ("increase", $t);
call_user_method ("increase", $t);
call_user_method ("increase", $t);
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 16:00:01 2025 UTC |
call_user_method("increase", &$t); works too with PHP 4.1.0RC1 but this function is deprecated.