Can I overload methods in PHP?

后端 未结 6 1894
隐瞒了意图╮
隐瞒了意图╮ 2021-01-06 20:01

Example:

I want to have two different constructors, and I don\'t want to use func_get_arg(), because then it\'s invisible what args are possible.

Is it legal

6条回答
  •  無奈伤痛
    2021-01-06 20:31

    You can also use func_get_args() to create pseudo-overloaded functions, though that may cause a confusing interface for your method/function.

提交回复
热议问题