Zend - The PHP Company




Text

Add Code


Dictionary.com interface  

Type: code fragment
Added by: amars
Entered: 26/04/2002
Last modified: 05/12/2001
Rating: - (fewer than 3 votes)
Views: 5478
Adds the ability to flag a keyword so that it presents a link to it's definition.


<?php
function dict($string)
{
  return 
preg_replace('/[dict](.*?)[/dict]/','\1 <font size=1>[<a href=http://www.dictionary.com/search?q=\1>?</a>]</font>',$string);
}

?>


Usage Example


$string="[dict]foo[/dict]";
echo dict($string);

outputs foo <font size=1>[<a href=http://www.dictionary.com?search?q=foo>?</a>]</font>


Rate This Script





Search



This Category All Categories