|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-08-25 06:09 UTC] andi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
If you call a object method with call_user_method(), it can't handle its own object properties anymore. The demo below returns 1,2,3 for the direct calls as expected, but then just 4,4,4 for the indirect calls. class test { var $a=0; function increase() { $this->a++; echo "a is now: ".$this->a."\n<br>"; } } $t = new test(); echo "Direct calls:\n<br>"; $t->increase(); $t->increase(); $t->increase(); echo "<p>\n\nIndirect calls:\n<br>"; call_user_method ("increase", $t); call_user_method ("increase", $t); call_user_method ("increase", $t);