2010/1/11 omar zorgui <omarzor...@gmail.com>:
> $sentences = "this is a example sentence";
> $sentences = "a this is example sentence";
> $sentences = "example this is a sentence";
> $sentences = "this is a example sentence for a function";
// Define data.
$Sentences = array
"this is a example sentence",
"a this is example sentence",
"example this is a sentence",
"this is a example sentence for a function",
// Record hashes of the sorted words in each sentence.
$Hashes = array();
$Reduced = array_filter
// Explode the sentence into words but forced to lower case.
$Words = explode(' ', strtolower($Sentence));
// Sort the words
// If the hash of the serialized words array is not already
if (!in_array($Hash = md5(serialize($Words)), $Hashes))
// then add it and return true.
$Hashes = $Hash;
// else return false to filter out this sentence.
// Show the reduced sentences.
 => this is a example sentence
 => this is a example sentence for a function
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php