Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php call class dynamically

class Player {
    public function SayHi() { print("Hi"); }
}
$player = new Player();

call_user_func(array($player, 'SayHi'));
// or
$player->{'SayHi'}();
// or
$method = 'SayHi';
$player->$method();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #call #class #dynamically
ADD COMMENT
Topic
Name
6+3 =