Can I use PHP reserved names for my functions and classes?

后端 未结 6 607
时光说笑
时光说笑 2020-11-28 15:50

I\'d like to create a function called \"new\" and a class called \"case\".

Can I do that in PHP?

6条回答
  •  我在风中等你
    2020-11-28 16:35

    You can't do that, an alternative option is to just use _case() or _new() as the function names

    Also check out:

    Is it possible to "escape" a method name in PHP, to be able to have a method name that clashes with a reserved keyword?

提交回复
热议问题