gpt4 book ai didi

php - preg_match :print: class matches tab character

转载 作者:可可西里 更新时间:2023-11-01 12:54:14 26 4
gpt4 key购买 nike

for($i = 0; $i < 255; $i++)
if (preg_match('@[[:print:]]@', chr($i))) echo "chr($i) matches :print:<br>"; else echo "chr($i) doesnt match :print:<br>";

在我的 Windows 系统上,chr(9) 的输出是:

chr(9) matches :print:

同样的代码,在Linux系统上,输出为:

chr(9) doesnt match :print:

为什么 :print: 类仅在 Windows 上匹配 \t

  • PHP 5.5.12

最佳答案

这可能是语言环境问题,但您手头上一定有一个非常时髦的语言环境。 POSIX 规定没有cntrl 可以print,没有spaceblank 可以print 除非它是空格字符本身。在 “C” 语言环境中,tab 是 all cntrlspaceblank;这似乎是一个非常奇怪的语言环境,不会考虑这些。

关于php - preg_match :print: class matches tab character,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23745938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com