PHP variable / function / class names using special characters

后端 未结 5 1549
忘了有多久
忘了有多久 2021-02-12 22:40

I understand that the underscore _ is an acceptable character for naming variables / functions / classes etc. However I was wondering if there are any other special

5条回答
  •  面向向阳花
    2021-02-12 23:23

    You can find the information you're looking for the PHP Manual. Know, has been answered:

    Function names follow the same rules as other labels in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.

    Function as regular expression: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*

    The information in the manual does not reflect Namespaces (some might see them as part of the function name). And with some identifiers the information in the PHP manual is not precise. See PHP Syntax Regulary Expressed for various elements and the links into the PHP Manual for them.

提交回复
热议问题