如何使用PHP在数组中加粗HTML文本?

如何使用PHP在数组中加粗HTML文本?,php,html,Php,Html,我有一小段代码 <?php foreach ($options['attributes_info'] as $attribute) : ?> <?php echo '<br/>&nbsp;&nbsp;' . $this->getPdfHelper()->fixEncoding( $attribute['label'] . ': ' . $at

我有一小段代码

<?php 
     foreach ($options['attributes_info'] as $attribute) : 
?>
<?php 
         echo '<br/>&nbsp;&nbsp;' .
              $this->getPdfHelper()->fixEncoding(
                  $attribute['label'] . ': ' . $attribute['value']
              ) 
?>  
<?php 
     endforeach; 
?> 

如何用粗体HTML标记回显的“值”

'<b>' . $attribute['value'] . '</b>'

您可以使用标记包装文本

<p><b>This text is bold</b>.</p>

谢谢我仍在学习基础知识,非常感谢您的帮助。@Dewstar回答得好。您应该解释您更改了什么以及更改它的原因。我将php echo更改为短标记,有些人认为这比编写echo更明显,并且还将函数调用分为两个调用,因为变量本身需要转义,而不是整个字符串。当你这样做的时候,你可以把标签包起来。这就是我所做的…谢谢你的改进,卢克
 <?php foreach ($options['attributes_info'] as $attribute) : ?>
 &nbsp;&nbsp;<?= $this->getPdfHelper()->fixEncoding($attribute['label']) ?> : <b><?= $this->getPdfHelper($attribute['value']) ?></b>
 <?php endforeach; ?>