Reference to static method in PHP?

前端 未结 8 2419
伪装坚强ぢ
伪装坚强ぢ 2021-02-18 18:20

In PHP, I am able to use a normal function as a variable without problem, but I haven\'t figured out how to use a static method. Am I just missing the right syntax, or is this

8条回答
  •  醉酒成梦
    2021-02-18 18:55

    You could use the full name of static method, including the namespace.

    The name array array('YourClass', 'staticMethod') is equal to it. But I think the string may be more clear for reading.

提交回复
热议问题