【发布时间】:2020-07-16 13:07:55
【问题描述】:
$str = str_repeat('a', 1024 * 1024);
//$str = str_repeat('a', 1024);
$temp = preg_replace('#.*?^-+[^-]+-+[\r\n ]*$#ms', '', $str, 1);
echo strlen($temp);
str_repeat('a', 1024)$temp 的长度为 1024,str_repeat('a', 1024 * 1024)$temp 的长度为 0。
我正在运行 PHP 7.4.3。
可能是什么问题?
【问题讨论】:
-
使用 str_repeat('a', 1024) 时 $temp 的长度是 1024 但使用 str_repeat('a', 1024 * 1024) 时 $temp 的长度是 0并不真地。 3v4l.org/1b4SE
-
显然和 preg_replace 有关。