Match and Encrypt Few Chars in Word
<p>I am developing a screening logic where complete text of content to be matched with list of keywords in php via regular expression.
I am using the following code which match words properly and make it bold.</p>

<pre><code>$pattern = "/mango|apple|banana/";
$text = "i like banana and apple alot";
$replacement = "&lt;strong&gt;$0&lt;/strong&gt;";
echo preg_replace($pattern, $replacement, $text);
</code></pre>

<p>this code properly match and make matched word enclosed in strong like</p>

<pre><code>i like &lt;strong&gt;banana&lt;/strong&gt; and &lt;strong&gt;apple&lt;/strong&gt; alot.
</code></pre>

<p>But i want to replace banana as </p>

<pre><code>b****a and apple as a****e 
</code></pre>

<p>instead of making it bold.</p>

<p>Can anyone help me how it will be possible.</p>
