我使用
或其等效物:
如果
但是在4.4.0-4.4.9、5.0.5-5.1.6版本中,它可以正常工作。
问题出在哪里?
请参考: http://3v4l.org/T3rpV
php.exe
运行了以下脚本:preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);
或其等效物:
preg_replace('#(?:^[^\pL]*|[^\pL]*$)#u','',$string);
如果
$string="S"
或者 $string=" ذذ "
,它是可以正常工作的。但是,如果 string='ذ'
,则会产生错误的输出�
;而如果 string='ذذ'
,则PHP会崩溃。但是在4.4.0-4.4.9、5.0.5-5.1.6版本中,它可以正常工作。
问题出在哪里?
请参考: http://3v4l.org/T3rpV
<?php
$string='دد';
echo preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);
Output for 5.4.0 - 5.5.0alpha6
Process exited with code 139.
Output for 5.2.0 - 5.3.22, 5.5.0beta1
Output for 4.4.0 - 4.4.9, 5.0.5 - 5.1.6
دد
Output for 4.3.11, 5.0.0 - 5.0.4
Warning: preg_replace(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 3
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 3