[英]PHP - example of function or class name with \x7f-xff char
PHP manual says that legal char set for class of function name is PHP手册说 ,函数名称类的合法字符集为
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]
And I m confused how to use \\x7f-\\xff
as first char. 我很困惑如何使用
\\x7f-\\xff
作为第一个字符。
function 0x7ftest(){}
and 和
function \x7ftest(){}
raise execution errors. 引发执行错误。
Can someone make an example, plz? 有人可以举例吗?
\\x
means that it is hex-encoded. \\x
表示它是十六进制编码的。 \\x7F
is the non-printable DEL character. \\x7F
是不可打印的DEL字符。 Many of the characters in the [\\x7f-\\xff]
range are non-printable, or are modifiers that are used with other characters to modify what they look like. [\\x7f-\\xff]
范围内的许多字符都是不可打印的,或者是与其他字符一起使用以修改其外观的修饰符。
You can use this page to find the characters (in the The extended ASCII codes table, HEX column). 您可以使用此页面查找字符(在“扩展ASCII码”表的“ 十六进制”列中)。
For example, you can use \\x8C
(the Œ character), like this: 例如,可以使用
\\x8C
(the字符),如下所示:
function Œ() {
return "Œ is a ligature of OE!";
}
echo Œ();
You should refrain from using these characters in your code because you cannot easily type them using most keyboards, and because most of them are non-printable (ie they do not appear on the screen as characters, or if they do they often appear as some "unknown" character: ?, or □). 您应该避免在代码中使用这些字符,因为您无法使用大多数键盘轻松键入这些字符,并且由于它们中的大多数是不可打印的(即,它们不会以字符的形式出现在屏幕上,或者如果它们经常以某些字符的形式出现, “未知”字符:?, 或□)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.