目前我有这段代码,它将任何双空格替换为<br />
.
它按预期工作:
<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">
<td>Garments:</td>
<td>' . str_replace(' ', '<br /><br />', trim($result['garment_type'] ) ) . '</td>
</tr>
不过我想做另一个str_replace()
在同一行上用管道字符替换任何单个空格|
.
我尝试复制代码,但这只是创建了另一个TD
for me.
任何帮助,将不胜感激。
您可以将数组传递给 str_replace
$what[0] = ' ';
$what[1] = ' ';
$with[0] = '<br /><br />';
$with[1] = '|';
str_replace($what, $with, trim($result['garment_type'] ) )
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)