How can I call a normal (not static) class function by its name?
The below gives an error saying param 1 needs to be a valid callback. I don't want the function to be static, I want it to be a normal function, and all the examples I've seen so far had them static.
class Player
{
public function SayHi() { print("Hi"); }
}
$player = new Player();
call_user_func($Player, 'SayHi');
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…