$text为要高亮的源文本
$keywords需要高亮的关键字
<?php
$text = "php multiple highlight keywords";
$keywords = ['php', 'highlight'];
$highlights = [];
foreach ($keywords as $word) {
$highlights[] = "<font color='#00f'><b>" . $word . "</b></font>";
}
echo strtr($text, array_combine($keywords, $highlights));
// Output: <font color='#00f'><b>php</b></font> multiple <font color='#00f'><b>highlight</b></font> keywords