PHP two methods with the same name

前端 未结 4 954
借酒劲吻你
借酒劲吻你 2021-02-07 14:04

Can I have two methods sharing the same name, but with different arguments?

One would be public static and would take 2 arguments, the other one just public and takes on

4条回答
  •  野的像风
    2021-02-07 14:51

    PHP currently doesn't support overloading in known way, but you can still achieve your goal by using magic methods.

    From PHP5 manual: overloading.

提交回复
热议问题