duandun3178 2015-07-19 13:16
浏览 102
已采纳

PHP - 带有\ x7f-xff char的函数或类名的示例

PHP manual says that legal char set for class of function name is

[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]

And I m confused how to use \x7f-\xff as first char.

function 0x7ftest(){}

and

function \x7ftest(){}

raise execution errors.

Can someone make an example, plz?

  • 写回答

1条回答 默认 最新

  • dongshan1959 2015-07-19 13:26
    关注

    \x means that it is hex-encoded. \x7F is the non-printable DEL character. 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.

    You can use this page to find the characters (in the The extended ASCII codes table, HEX column).

    For example, you can use \x8C (the Πcharacter), like this:

    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 (i.e. they do not appear on the screen as characters, or if they do they often appear as some "unknown" character: ?, � or □).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办