PHP forward_static_call vs call_user_func

后端 未结 1 903
一整个雨季
一整个雨季 2021-02-07 08:57

What is the difference between forward_static_call and call_user_func

And the same question applies to forward_static_call_array a

1条回答
  •  灰色年华
    2021-02-07 09:50

    The difference is just that forward_static_call does not reset the "called class" information if going up the class hierarchy and explicitly naming a class, whereas call_user_func resets the information in those circumstances (but still does not reset it if using parent, static or self).

    Example:

    Note that forward_static_call refuses to forward if going down the class hierarchy:

    Finally, note that forward_static_call can only be called from within a class method.

    0 讨论(0)
提交回复
热议问题