我使用以下脚本运行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版本中工作。
怎么了?
<?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
相似问题