note 16421 deleted from language.oop by aidan
| From: | aidan@php.net | Date: | Sat, 03 Jul 2004 14:57:05 +0000 |
| Subject: | note 16421 deleted from language.oop by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72466@lists.php.net to get a copy of this message | ||
Note Submitter: dougqh@hotmail.com
----
If you want to call a method of class and you do not have an instance of the class and you have the
class, method name, or both stored in a variable(s) you can use the following ...
call_user_func( array( $className, $functionName ), [ $param0 [, $param1 [, ... ] ] ] )
For example
$class = "MyClass";
$method = "myMethod";
call_user_func( array( $class, $method ), 0, 1 );
is equivalent to
MyClass::myMethod( 0, 1 );