Exotic names for methods, constants, variables and fields - Bug or Feature?

后端 未结 4 1843
死守一世寂寞
死守一世寂寞 2020-11-28 07:26

after some confusion in the comments to

  • Is it safe to have 1 letter class names in PHP, e.g A, B, C

I thought I make into a question. According

4条回答
  •  鱼传尺愫
    2020-11-28 07:29

    From the official documentation:

    The class name can be any valid label, provided it is not a PHP reserved word. A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$.

提交回复
热议问题