<?php
function highlightWords($content)
{
$arr=array("php", "and sql", "sql");
foreach ($arr as $key=>$value)
{
$content=preg_replace("/(?!<a href="#">)\b(".preg_quote($value).")\b/i", '<a href="#">\1</a>', $content, 1);
}
return $content;
}
echo highlightWords("This text will highlight PHP and SQL and sql but not PHPRO or MySQL or sqlite");