Dynamic class method invocation in PHP

后端 未结 8 1987
感动是毒
感动是毒 2020-11-28 05:05

Is there a way to dynamically invoke a method in the same class for PHP? I don\'t have the syntax right, but I\'m looking to do something similar to this:

$t         


        
8条回答
  •  醉酒成梦
    2020-11-28 05:28

    If you're working within a class in PHP, then I would recommend using the overloaded __call function in PHP5. You can find the reference here.

    Basically __call does for dynamic functions what __set and __get do for variables in OO PHP5.

提交回复
热议问题