note 17870 deleted from function.call-user-method by jimw

From: Date: Wed, 02 Jan 2002 11:55:32 +0000
Subject: note 17870 deleted from function.call-user-method by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-24247@lists.php.net to get a copy of this message
Instead of using this function, I would recommend running methods via the eval(): class my_class { ... function anymethod() { ... } } $my_object = new my_class(); $my_method = 'anymethod()'; $str_object = '$my_object'; /* notice how it is a string of the object */ eval($tr_object.'->'.$my_method); The reason I like this method more than the call_user_method() function is that call_user_method() has trouble when you have classes embedded in classes, like: $class = new classname(); $class->any_variable = new class2name(); Running methods that are in the class object "$class->any_variable" do not seem to work.

« previous php.notes (#24247) next »