Php Convert String Specific Words Within Paragraphs Into Links. This little jewel allows you to do some sneaky self made tags within your blog or forum. Can be used before input or even better on coming out of the database query. The thing to remeber is that arrays are mirrored within preg_replace and require the $replacements variables to be in numeric reverse order. If you add another to the list it will be $items and the new $replacements var will become  which moves the replacements up one numeric order. This would place shoes replacement at  shirts at  and jeans at then new item var at .
$string = 'She has shirts in blue her jeans in black and her shoes are all faded.';
$items = array();
$items = '/shoes/'; //List of items you want changed//
$items = '/shirts/';
$items = '/jeans/';
$replacements = array();
$replacements = 'a href="http://www.example.com/foot/shoes.php">Shoes /a>';
$replacements = 'a href="index.php?items=shirts">Shirts /a>';
$replacements = 'a href="index.php?items=jeans">Jeans /a>';
$output = preg_replace($items, $replacements, $string);
echo $output;// OR QUERY BACK INTO DATABASE//
Outputs: The paragraph and links on the selected items.