我想$member
在下面代码的最后一个末尾添加一个空行以区分每个组。我试过下面的代码
foreach($members as $key => $member)
{
$member = trim(preg_replace('/\s\s+/', ' ', $member));
$dev = " $member part of Form; <br>";
echo str_replace("<br>", "\r\n", $dev);
if($key == count($member)-0)
{
$space = "<br>";
echo str_replace("<br>", "\r\n", $space);
}
}
但是它在每 2 行之后添加一个空格。如何仅在最后一个字符串的末尾添加空格?