How to create an hyperlink in a paragraph using php
<p>I would like to create hyperlinks to the words in a paragraph.</p>

<p>For instance if the <code>"Jim Carrey"</code> name is in the array matches the word in string, then the Jim Carrey name should be in Hyperlink of <code>"www.domian.net/name(Jim Carrey)"</code> .
 If the <code>"mask"</code> word in the array matches the word in string then it should be replace with corresponding url like <code>"www.domian.net/mask"</code></p>

<pre><code>&lt;?php 

$string="Jim Carrey found the new Mask";

$array=array("Jim Carrey","mask");

echo preg_replace( '/\b('.implode( '|', $array ).')\b/i', '&lt;a href=" "&gt;$1&lt;/a&gt;', $string  );

?&gt;
</code></pre>
