我怎么能在数字之前添加换行符?

时间:2022-04-26 07:41:29

I would like to add a line break between the bolded content.

我想在粗体内容之间添加换行符。

This is what is being displayed in a column

这是列中显示的内容

85025 Blood Count Complete Auto&auto Difrntl Wbc Count82977 Glutamyltrase Gamma80053 Comprehensive Metabolic Panel81000 Urinls Dip Stick/tablet Reagnt Non-auto Micrscpy

85025血细胞计数完全自动和自动差异Wbc Count82977谷氨酰胺Gamma80053综合代谢Panel81000尿液浸棒/片剂Reagnt非自动Micrscpy

I have changed it to <br> and it does not work

我已将其更改为
并且无效

 $subject = ucwords(strtolower($row['myitem']));

echo "  <td class='detail'>&nbsp;" . $subject . "</td>\n";

2 个解决方案

#1


0  

here $row is array with multiplemyitem yes? so $subject is an array so you ve to loop through each value of array $subject

这里$ row是带有multiplemyitem的数组是吗?所以$ subject是一个数组,所以你必须循环遍历数组$ subject的每个值

foreach($subject as $key=>$value){
     echo '<tr><td class="detail">&nbsp;' . $value . '</td></tr>';
}

here <tr> gives you line break.

这里给你换行。

If i've understand you properly may be it's you are looking for or let me know if i am wrong..

如果我理解你可能是你正在寻找或让我知道我是错的..

#2


0  

is this what you want?

这是你想要的吗?

<?php
$subject = "85025 Blood Count Complete Auto&auto Difrntl Wbc Count82977 Glutamyltrase Gamma80053 Comprehensive Metabolic Panel81000 Urinls Dip Stick/tablet Reagnt Non-auto Micrscpy";

$searchStr1 = "Count82977";
$searchStr2 = "Panel81000";

$str1 = str_replace($searchStr1, '<br/>'.$searchStr1.'<br/>', $subject);

$str2 = str_replace($searchStr2, '<br/>'.$searchStr2.'<br/>', $str1);

echo $str2;
?>

#1


0  

here $row is array with multiplemyitem yes? so $subject is an array so you ve to loop through each value of array $subject

这里$ row是带有multiplemyitem的数组是吗?所以$ subject是一个数组,所以你必须循环遍历数组$ subject的每个值

foreach($subject as $key=>$value){
     echo '<tr><td class="detail">&nbsp;' . $value . '</td></tr>';
}

here <tr> gives you line break.

这里给你换行。

If i've understand you properly may be it's you are looking for or let me know if i am wrong..

如果我理解你可能是你正在寻找或让我知道我是错的..

#2


0  

is this what you want?

这是你想要的吗?

<?php
$subject = "85025 Blood Count Complete Auto&auto Difrntl Wbc Count82977 Glutamyltrase Gamma80053 Comprehensive Metabolic Panel81000 Urinls Dip Stick/tablet Reagnt Non-auto Micrscpy";

$searchStr1 = "Count82977";
$searchStr2 = "Panel81000";

$str1 = str_replace($searchStr1, '<br/>'.$searchStr1.'<br/>', $subject);

$str2 = str_replace($searchStr2, '<br/>'.$searchStr2.'<br/>', $str1);

echo $str2;
?>