xxxxxxxxxx
class Player {
public function SayHi() { print("Hi"); }
}
$player = new Player();
call_user_func(array($player, 'SayHi'));
// or
$player->{'SayHi'}();
// or
$method = 'SayHi';
$player->$method();
xxxxxxxxxx
<?php
class helloo {
public function hello(){
return " hello world";
}
public function sayHi(){
return " hi ";
}
}
// method 1
echo helloo::hello(); // " hello world "
echo helloo::sayHi(); // " hi "
// method 2
$new = new helloo();
$new->hello(); // " hello world "
$new->sayHi(); // " hi "